如何使用.net 4.0实体框架6轻轻松松 [英] How will I use breeze with Entity Framework 6 with .net 4.0

查看:240
本文介绍了如何使用.net 4.0实体框架6轻轻松松的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用nuget安装了我的4.0 MVC项目,Entity Framework 6(启用ode第一次迁移)。然后我尝试安装微风包Breeze.Server.ContextProvider.EF6。但是我有一些缺少装配参考错误的微风。

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.

推荐答案

我能够使用Entity Framework 6在.NET 4.0上获得Breeze的唯一方法是使用来自GitHub的Breeze源代码创建我自己的EF6ContextProvider作为起点。

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.

我创建了一个项目 Breeze.WebApi.EF6 并添加了一个类 EF6ContextProvider.cs 这是几乎是官方的 Breeze.WebApi.EF 项目中的 EFContextProvider.cs 的直接副本。唯一真正的变化是重命名命名空间和类,并使用语句调整,以使EF6(代码太长不能发布)。该项目具有NuGet引用 Breeze.Server.WebApi.Core EntityFramework - Breeze包拉入一堆依赖关系,我不得不添加对几个系统程序集的引用以使其编译。

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.

然后,在我的MVC / WebAPI项目中,我刚刚获得了NuGet引用 Breeze.Client Breeze.Server.WebApi.Core 和项目对 Breeze的引用。 WebApi.EF6 项目。

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.

显然这是一个黑客。我已经创建了一个用于官方支持的UserVoice项目

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

这篇关于如何使用.net 4.0实体框架6轻轻松松的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆