在CLR存储过程中使用实体框架 [英] Use Entity Framework in CLR Stored procedure

查看:99
本文介绍了在CLR存储过程中使用实体框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现大约七年前有一篇文章说实体框架不能用于CLR存储过程中。在过去七年左右的时间里,这种情况是否得到纠正?是否有可用的更新允许Entity Framework在CLR存储过程中工作?

I found a post from seven or so years ago that the Entity Framework could not be used in a CLR stored procedure. Has this been rectified in the past seven or so years? Is an update available that will allow the Entity Framework to work in a CLR stored procedure?

推荐答案

您不这样做的正常原因这是因为,如果您 did ,则必须将EF依赖的所有.NET Framework程序集作为不安全的程序集安装到数据库中,并且每次.NET Framework时都必须对其进行更新。服务器上的更新。从EF 6.2开始,该列表为:

The normal reason you don't do this is that if you did, you would have to install all of .NET Framework assemblies that EF depends on into the database as unsafe assemblies, and you would have to update them every time the .NET Framework on the server was updated. As of EF 6.2 that list is :

smdiagnostics.dll
system.runtime.serialization.dll
system.dynamic.dll
microsoft.csharp.dll

这是安装更新后的补充

entityframework.dll  
entityframework.sqlserver.dll

其中将包含自定义CLR dll的更新版本。

Which would come along with updated versions of your custom CLR dll.

然后您将开始在SQL CLR中测试EF以确定它a)是否有效,b)在SQLCLR的唯一托管环境中能否很好地发挥作用。

And then you would have to start testing EF in SQL CLR to determine if it a) works and b) plays nicely in SQLCLR's unique hosting environment.

这篇关于在CLR存储过程中使用实体框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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