EFMVC App Migrated to ASP.NET MVC 4

I have upgraded my EFMVC app from ASP.NET MVC 3 to ASP.NET MVC 4 Beta. EFMVC is a demo web app initially built for demonstrating ASP.NET MVC and EF Code First. Now I am planning to add more features onto EFMVC and want to add cloud specific features with Windows Azure. You can expect more implementations in future releases.

The current migration does not contains any major code changes. I have added a Windows Azure web role and will add some cloud specific features on later. The migration process was very smooth and the Autofac.MVC3 has been working with ASP.NET MVC 4 app without any issue.  But I am having some issues with  Autofac.MVC3 package while integrating with ASP.NET Web API services. I have used the current AutofacDependencyResolver class to integrating with DependencyResolver. The ASP.NET Web API expects a System.Web.Http.Services.IDependencyResolver implementation instead of System.Web.Mvc.IDependencyResolver which is used by ASP.NET MVC.

The below is the updated feature list of the EFMVC app

  • Windows Azure Web Role
  • CRUD demo in ASP.NET MVC 4 with Entity Framework 4.3 Code First
  • Generic repository for Entity Framework Code First
  • Repository Pattern and Unit of Work
  • Dependency Injection using Autofac
  • Razor View Engine
  • Solution Architectures using Commands(write operations), Command Handlers, Command Dispatcher

You can download the source from http://efmvc.codeplex.com/


  • I think that the EFMVC.Web.API Project isn't working... when you invoke a HTTP GET on this endpoint:/api/category you get the following error: You must write an attribute 'type'='object' after writing the attribute with local name '__type'. Any ideas?

  • Hello,
    Im having a problem setting up a Test project with the solution. Im trying to test all the Domain code using the autofac. The problem Im having is that you use DependencyResolver in the code for DefaultCommandBus and this only works under MVC. Is there a way to resolve the Container in the class?
    I tried setting it up as a property and passing it as parameter and nothing (null).

    this.commandBus = this.container.Resolve(new NamedParameter("Container", this.container));

  • Great to hear. I've been missing it.

Comments have been disabled for this content.