实体框架6与Sharepoint 2013 [英] Entity Framework 6 with Sharepoint 2013

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

问题描述

我没有成功地尝试使SharePoint 2013应用程序页面或Web部件与Entity Framework 6(6.0.1确切地说是在默认情况下使用NuGet在写入时安装到Visual Studio 2012中的版本)。 p>

我的代码测试非常简单,只需从一张表中读取数据。



我可以安装包好的,创建模型,看到他们被正确配置等,没问题 - 但是每当我尝试加载页面我得到错误:



事件代码:3008
异常类型:ConfigurationErrorsException
异常消息:创建entityFramework的配置节处理程序时发生错误:无法加载文件或程序集EntityFramework或其一个依赖项。该系统找不到指定的文件。 (C:\inetpub\wwwroot\wss\VirtualDirectories\ [sitename] \web.config第36行)



我复制了所有的配置设置从VS中的App.Config文件(由EF安装创建)进入web.config,逐字。



我尝试了每个建议的修复,我可以在interweb上找到(例如,将EF组件更改为Specific version = false,将配置文件中的版本引用更改为特定版本...),但没有任何作用。



我使用相同的设置创建了一个控制台应用程序,它工作正常,所以我知道这不是一个特定于服务器的问题 - 看起来像SP2013的兼容性问题,任何想法?



我使用NuGet控制台安装了EF 5,终于得到了它的工作...但是我很好奇为什么EF 6拒绝



感谢
Poolio

解决方案

你需要部署Entity Framework程序集(EntityFramework.dll,EntityFramework.SqlServer.dll)作为SharePoint解决方案包的一部分。您可以参考包中的外部dll。


I tried without success to get a SharePoint 2013 application page or web part to work with Entity Framework 6 (6.0.1 to be exact - the version installed into Visual Studio 2012 by default using NuGet at time of writing).

My code was very simple for test purposes, just reading data from one table.

I could install the package just fine, create models, see that the they were properly configured etc, no problem - but whenever I tried to load the page I got the error:

Event code: 3008 Exception type: ConfigurationErrorsException Exception message: An error occurred creating the configuration section handler for entityFramework: Could not load file or assembly 'EntityFramework' or one of its dependencies. The system cannot find the file specified. (C:\inetpub\wwwroot\wss\VirtualDirectories\[sitename]\web.config line 36)

I copied all of the config settings from the App.Config file in VS (created by the EF install), into the web.config, verbatim.

I tried every suggested fix I could find on the interweb (e.g. changing the EF assembly ref to "Specific version = false", changing version refs in the config file to the specific version... all sorts) but nothing worked.

I created a console app using the same settings and it worked fine, so I know it's not a server-specific issue - looks like a compatibility issue with SP2013, anyone have any ideas?

I installed EF 5 using the NuGet console, and finally got it working with that... but I'm very curious as to why EF 6 refused to play ball.

Thanks Poolio

解决方案

You need to deploy the Entity Framework assemblies (EntityFramework.dll, EntityFramework.SqlServer.dll) as part of your SharePoint solution package. You can reference external dlls in the package.

这篇关于实体框架6与Sharepoint 2013的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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