Wednesday, March 18, 2009

Constructor Dependency Injection Design Pattern

Note on Constructor Dependency Injection design pattern. This is how it is in C#.

private IContactManagerRepository _repository;

 

public ContactController()

    : this(new EntityContactManagerRepository())

{ }

 

public ContactController(IContactManagerRepository repository)

{

    _repository = repository;

}

1 comments:

iSilver Labs said...

We just developed a open source Light Weight Ioc / Dependency Injection framework.

http://blog.isilverlabs.com/2010/08/lightweight-ioc-dependency-injection-framework/