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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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
This is in addition to installing updated versions of
entityframework.dll
entityframework.sqlserver.dll
Which would come along with updated versions of your custom CLR dll.
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.