First time here? You are looking at the most recent posts. You may also want to check out older archives or the tag cloud. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS. Thank you for visiting! (hide this)


There are 2 entries for the tag unity

Using Entity Framework within an Owin-hosted Web API with Unity

After quite a lot of time of writing applications without direct interaction with Databases, lately I’ve been working on a pretty simple ASP.NET Web API project that needs to save data on a database. Despite the simplicity of the application, I faced some interesting problems, which I’m going to write about in a few blog posts over the next weeks. The first of the problems, which I’m going to write about in this post, is how to configure an ASP.NET Web API application to run within Owin, have its dependencies resolved with Unity, and have Entity Framework DbContext injected...

ASP.NET MVC ControllerFactory for Unity and the reasoning behind it

Most of the mainstream IoC containers have their own implementation of a custom controller factory for ASP.NET MVC, but Unity doesn’t. There is an implementation in the MvcContrib project, but I don’t like the way it works, so I decided to implement it myself. Unity Controller Factory After a few mail exchanges with a guys of the p&p team and with Brad Wilson I came out with the following 35 lines of code. public class UnityControllerFactory: DefaultControllerFactory { protected override IController GetControllerInstance(Type controllerType) { ...