手动添加对实体框架的引用 [英] Manually adding a reference to Entity Framework

查看:100
本文介绍了手动添加对实体框架的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事一个围绕EF的项目. 我将项目的核心层分为不同的项目.

不幸的是,由于我在项目中缺少对EntityFramework.SqlServer.dll的引用,所以我不断收到正在发生的错误.

将.dll文件添加到build文件夹可以解决此问题,但是我想通过代码中的"using"语句解决该问题,但是由于我在项目中缺少对Entity Framework的引用,因此无法做到这一点.

我想知道如何添加一个?

* PS如果我在添加引用"面板中为EntityFramework进行搜索,那么我不会选择EF.

**我总是可以用NuGet来安装它,但是那不是多余的,因为我已经安装了它吗?

解决方案

在DAL使用EF的N层解决方案中,我遇到了同样的问题.

我通过在Web项目中添加对EntityFramework.SqlServer.dll的引用来解决此问题.

在对话框中转到引用->添加引用-> ,选择 COM 并按浏览. 然后转到使用EF的项目,然后转到存储EF引用的项目bin文件夹. 选择 EntityFramework.SqlServer.dll 并将其添加.

然后右键单击新添加的引用-> 属性->选择 Copy Local 为true

I am working on a project that revolves around EF. I have the core layers of my project separated into different projects.

Unfortunately I constantly get errors that are happening because I am missing a reference to EntityFramework.SqlServer.dll in my project.

Adding the .dll file to my build folder fixes this issue, but I want to solve it by a "using" statement in my code, however I cannot do that as I am missing a reference to Entity Framework in my project.

I was wondering how do I add one?

*PS If I serach for EntityFramework in the "Add reference" panel, I don't get EF as an option.

**I could always install it with NuGet, but wouldn't that be redundant, since I already have it installed?

解决方案

I had the same issue on a N-tier solution where the DAL uses EF.

I solved it by adding a reference to the EntityFramework.SqlServer.dll in the web project.

Go to references --> Add Reference --> in the dialog, choose COM and press browse. Then go to your project which is using EF and go to the projects bin folder where the EF references are stored. Select the EntityFramework.SqlServer.dll and add it.

Then right click on the newly added reference --> Properties --> Select Copy Local to true

这篇关于手动添加对实体框架的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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