Posts

Showing posts from November, 2017

Unity in a webAPI project

I have just created a proof of concept for a client where I demo how to configure Microsoft's Unity DI container to resolve the API controllers and their dependencies. The code is available in this github repository. The concepts that I tried to showcase are How to configure Unity in OWIN How to do automatic registration of IObject->Object references. How to use an injectionFactory to resolve object that depedn on dynamic data. Different Lifetime managers Container Controlled (Singleton) Per Resolve (Once per request) Transient (Once per call) Unit testing an application with dependencies Abstracting away the HttpContext from the controller, which is useful for unit testing. Take a look and comment in the blog or in the repo..