I hope I am not late. I am using ASP.NET MVC
4 and Entity Framework 6 alpha 3
and ran into a similar problem.
I have multiple projects in my solution. The 2 main projects are:
MyProject.Infrastructure.EntityFramework
MyProject.Web
In the first project I would set up all my repositories, DbContext
, etc etc. In this project I have 2 references:
EntityFramework
EntityFramework.SqlServer
The second project is my website. It uses the repositories in the first project to return my data. For example:
private readonly IMyRepository myRepository;
public MyController(IMyRepository myRepository)
{
this.myRepository = myRepository;
}
public ActionResult Details(int id)
{
MyObject myObject = myRepository.FindById(id);
return View();
}
This is where I had my issues, calling FindById
.
All that I did was to add the following reference to my website:
EntityFramework.SqlServer
In my web.config:
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
And beneath the closing system.webServer
tag:
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
I hope this will help.