How will I use breeze with Entity Framework 6 with .net 4.0

谁说胖子不能爱 提交于 2019-12-23 13:58:15

问题


I installed my 4.0 MVC project, Entity Framework 6 using nuget(to enable ode first migrations). Then I tried installing breeze package Breeze.Server.ContextProvider.EF6. But I'm having missing assembly reference errors for breeze.


回答1:


The only way I was able to get Breeze working on .NET 4.0 with Entity Framework 6 was to create my own EF6ContextProvider using the Breeze source code from GitHub as a starting point.

I created a project Breeze.WebApi.EF6 and added a class EF6ContextProvider.cs that was pretty much a direct copy of the EFContextProvider.cs in the official Breeze.WebApi.EF project. The only real changes were to rename the namespace and the class, and adjust the using statements for EF6 (the code is too long to post). This project has NuGet references to Breeze.Server.WebApi.Core and EntityFramework - the Breeze package pulls in a bunch of dependencies, and I had to add references to a couple of system assemblies to get it to compile.

Then, in my MVC/WebAPI project I just had NuGet references for Breeze.Client and Breeze.Server.WebApi.Core and a project reference to the Breeze.WebApi.EF6 project.

Obviously this is a bit of a hack. I have created a UserVoice item for official support.




回答2:


It seems like Breeze.Server.ContextProvider.EF6 is the only package from Breeze that you've installed. That's not enough. You need to install "Breeze Server - for Web API 2" (Breeze.Server.WebApi2).

You should have these lines in your packages.config:

<package id="Breeze.Server.ContextProvider" version="1.4.5" targetFramework="net45" />
<package id="Breeze.Server.ContextProvider.EF6" version="1.4.5" targetFramework="net45" />
<package id="Breeze.Server.WebApi2" version="1.4.5" targetFramework="net45" />


来源:https://stackoverflow.com/questions/20032288/how-will-i-use-breeze-with-entity-framework-6-with-net-4-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!