Dependency Injection in ASP.NET MVC3(itworksonmymachine.wordpress.com)

submitted by misbaharefinmisbaharefin(845) 1 year, 3 months ago

What dependency injection means is that instead of writing code like this in your controller private IBlogService _BlogService; public BlogController() { _BlogService = new BlogService(); } you write code like this private IBlogService _BlogService; public BlogController(IBlogService blogService) { _BlogService = blogService; } the benefits of dependency injection are your classes are not tightly coupled, are more testable, and really is pluggable. To enable dependency injection into your controllers in ASP.NET MVC2 you had to create a new class derived from DefaultControllerFactory and override the GetControllerInstance method to create the controller using your dependency injection container e.g.

add a comment |category: |Views: 21

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

No comments so far

information Login or create an account to comment on this story