【发布时间】:2014-12-19 04:33:37
【问题描述】:
如果有人能就我的问题提出建议,我将不胜感激。
我有一个 EF 版本 4.5 的类库项目。
项目的App.Config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<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=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</configSections>
<connectionStrings>
<add name="Entities" connectionString="..." providerName="System.Data.EntityClient"/>
<add name="REPORTSEntities" connectionString="..." providerName="System.Data.EntityClient"/>
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
</entityFramework>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
当我尝试将 dll 添加到 SQL Server 2012 时,我收到错误:
Assembly 'entityframework, version=5.0.0.0,culture=neutral,publickeytoken=b77a5c561934e089.'在 SQL 目录中找不到。 (错误:6503)
我做错了什么?
非常感谢。
【问题讨论】:
-
先尝试将所需的EntityFramework程序集添加到SQL Server
-
@JesseJames,当我尝试添加它时,我得到另一个错误:未找到 system.data.entity。您正在注册的 assebmly entityframework 未在 SQL Server 托管环境中进行全面测试,因此不受支持。将来,如果您升级或维护此程序集或 .NET 框架,您的 CLR 集成例程可能会停止工作。
-
检查这个线程。它关于你的错误。 stackoverflow.com/questions/2304357/…
-
感谢您的链接,那么我应该注册哪个程序集?当我尝试创建 EF 程序集时,它需要 System.Data.Entity。这又需要 system.runtime.serialization 等等..
-
嗯,但是为什么要向 SQL Server 添加程序集呢?这称为
SQL Server CLR Integration,用于对 SQL Server 和数据执行复杂的操作。如果您仍然需要它,您应该将 sqlopeartion 提取到另一个不会引用实体框架的程序集中
标签: c# sql-server visual-studio-2012 sql-server-2012 .net-assembly