MVC

Dependency Injection in ASP.NET MVC NerdDinner App using Ninject


In this post, I am applying Dependency Injection to the NerdDinner application using Ninject. The controllers of NerdDinner application have Dependency Injection enabled constructors. So we can apply Dependency Injection through constructor without change any existing code.

A Dependency Injection framework injects the dependencies into a class when the dependencies are needed. Dependency Injection enables looser coupling between classes and their dependencies and provides better testability of an application and it removes the need for clients to know about their dependencies and how to create them.

If you are not familiar with Dependency Injection and Inversion of Control (IoC), read Martin Fowler’s article Inversion of Control Containers and the Dependency Injection pattern. The Open Source Project NerDinner is a great resource for learning ASP.NET MVC. 

A free eBook provides an end-to-end walkthrough of building NerdDinner.com application. The free eBook and the Open Source Nerddinner application are extremely useful if anyone is trying to lean ASP.NET MVC.

The first release of  Nerddinner was as a sample for the first chapter of Professional ASP.NET MVC 1.0. Currently the application is updating to ASP.NET MVC 2 and you can get the latest source from the source code tab of Nerddinner at http://nerddinner.codeplex.com/SourceControl/list/changesets.

I have taken the latest ASP.NET MVC 2 source code of the application and applied  Dependency Injection using Ninject and Ninject extension Ninject.Web.Mvc.

Ninject is a lightweight and a great dependency injection framework for .NET.  Ninject is a great choice of dependency injection framework when building ASP.NET MVC applications. Ninject.Web.Mvc is an extension for ninject which providing integration with ASP.NET MVC.

View the Original article



Be the first to comment - What do you think?
Posted by Anand Narayanaswamy - May 29, 2010 at 8:20 pm

Categories: MVC   Tags: ASP.NET, briefly about c# and c# tools, c sharp compiler download, c# compilers, C# keywords classified, Dependency, develop in c# in windows98, download C# compiler for windows xp, download different Types Of Compilers in C#, explain briefly about c# and c# tools, Injection, multiform application in C#.Net, NerdDinner, Ninject, Using

NoSQL with RavenDB and ASP.NET MVC – Part 1

A while back, I have blogged NoSQL with MongoDB, NoRM and ASP.NET MVC Part 1 and Part 2 on how to use MongoDB with an ASP.NET MVC application. The NoSQL movement is getting big attention and RavenDB is the latest addition to the NoSQL and document database world. RavenDB is an Open Source (with a commercial option) document database for the .NET/Windows platform developed  by Ayende Rahien. 

Raven stores schema-less JSON documents, allow you to define indexes using Linq queries and focus on low latency and high performance. RavenDB is .NET focused document database which comes with a fully functional .NET client API  and supports LINQ.

RavenDB comes with two components, a server and a client API. RavenDB is a REST based system, so you can write your own HTTP cleint API. As a .NET developer, RavenDB is becoming my favorite document database. Unlike other document databases, RavenDB is supports transactions using System.Transactions.

Also it’s supports both embedded and server mode of database. You can access RavenDB site at http://ravendb.net. Let’s create a simple demo app with RavenDB and ASP.NET MVC. To work with RavenDB, do the following steps.

Go to http://ravendb.net/download and download the latest build.

Unzip the downloaded file.

Go to the /Server directory and run the RavenDB.exe.

This will start the RavenDB server listening on localhost:8080. You can change the port of RavenDB  by modifying the “Raven/Port” appSetting value in the RavenDB.exe.config file. When running the RavenDB, it will automatically create a database in the /Data directory.

You can change the directory name data by modifying “Raven/DataDirt” appSetting value in the RavenDB.exe.config file.

RavenDB provides a browser based admin tool. When the Raven server is running, You can be access the browser based admin tool and view and edit documents and index using your browser admin tool. The web admin tool available at http://localhost:8080.

View the Original article

Be the first to comment - What do you think?
Posted by Anand Narayanaswamy - May 26, 2010 at 7:25 pm

Categories: MVC   Tags: ASP.NET, briefly about c# and c# tools, c sharp compiler download, c# compilers, C# keywords classified, develop in c# in windows98, download C# compiler for windows xp, download different Types Of Compilers in C#, explain briefly about c# and c# tools, multiform application in C#.Net, NoSQL, RavenDB

RapidWebDev – a new enterprise software development infrastructure in .NET

RapidWebDev is an infrastructure helps engineers to develop enterprise software solutions in Microsoft .NET easily and productively. It consists of an extendable and maintainable web system architecture with a suite of generic business model, APIs and services as fundamental functionalities needed i

Read more...

1 comment - What do you think?
Posted by Eunge - February 6, 2010 at 11:32 am

Categories: .NET (.NET1.0, .NET1.1, .NET2.0, .NET3.0, .NET3.5), ADO.NET, ajax, Architect, ASP.NET, C# (C#2.0, C#3.0), C#4.0), CEO, css, Design, Dev, html, JavaScript, jQuery, linq, Marketing, MVC, Sales, Visual-Studio (VS2008), VS2010), WebForms, XHTML, xml   Tags: briefly about c# and c# tools, c sharp compiler download, c# compilers, C# keywords classified, develop in c# in windows98, download C# compiler for windows xp, download different Types Of Compilers in C#, explain briefly about c# and c# tools, mailmergelib samples, multiform application in C#.Net