2
Shouts

Dependency Injection in ASP.NET MVC3 « It Works On My Machine

posted by http://itworksonmymachine.wordpress.com/http://itworksonmymachine.wordpress.com/ 817 days, 21 hours ago
Monday, February 28, 2011 11:57:05 AM GMT

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.

category: Web Dev | clicked: 3 | | source: itworksonmymachine.wordpress.com | show counter code
tags: Unity, Dependecy Injection, MVC 3, ASP.NET 4

No comments yet, be the first one to post comment.

To post your comment please login or signup