Thursday, August 25, 2016

Using Unity IoC with constructor parameters

I recently decided to switch my IoC container from Ninject to Unity for my ASP.NET Web API Web Application because the Ninject IoC container has poor support for Web API and has not been updated/refreshed in several years.

So, naturally, when I began switching my code over from Ninject over to Unity, one of the questions that immediately came up was how to use constructor parameters for my types in Unity?

Well, after doing some quick searching and experimentation, I came up with this solution:

It is as simple as that!

No comments:

Post a Comment