SQL Server 2008:动态操作只能在同构AppDomain中执行

时间:2015-07-05 07:38:31

标签: c# .net sql-server entity-framework sql-server-2008

我编写了一个存储过程来使用SQL Server 2008中的一个DLL。

create proc stpMine
as
EXTERNAL NAME MyDll.[MyDll.ClassName].[StaticMethod]

此库使用Entity Framework和Json.Net。当我尝试运行存储过程时,它给出了以下错误:

  

在执行用户定义的例程或聚合期间发生.NET Framework错误" stpMine":
  System.InvalidOperationException:动态操作只能在同类AppDomain中执行   System.InvalidOperationException:
  在System.Runtime.CompilerServices.CallSiteBinder.BindCore [T](CallSite 1 site, Object[] args)
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2[T0,T1](CallSite site, T0 arg0, T1 arg1)
at System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.<GenerateStatements>b__2(Object o)
at System.Data.Entity.SqlServer.Utilities.IEnumerableExtensions.Each[T](IEnumerable
1 ts,Action 1 action)
at System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GenerateStatements(IEnumerable
1 migrationOperations)
  在System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(IEnumerable 1 migrationOperations, String providerManifestToken)
at System.Data.Entity.Migrations.DbMigrator.GenerateStatements(IList
1次操作,String migrationId)
  at System.Data.Entity.Migrations.DbMigrator.ExecuteOperations(String migrationId,VersionedModel targetModel,IEnumerable 1 operations, IEnumerable 1 systemOperations,Boolean downgrading,Boolean auto)
  在System.Data.Entity.Migrations.DbMigrator.AutoMigrate(String migrationId,VersionedModel sourceModel,VersionedModel targetModel,Boolean downgrading)
  在System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable 1 pendingMigrations, String targetMigrationId, String lastMigrationId)
at System.Data.Entity.Migrations.DbMigrator.UpdateInternal(String targetMigration)
at System.Data.Entity.Migrations.DbMigrator.<>c__DisplayClassc.<Update>b__b()
at System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase)
at System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration)
at System.Data.Entity.Internal.DatabaseCreator.CreateDatabase(InternalContext internalContext, Func
3 createMigrator,ObjectContext objectContext)
  在System.D ......

任何人都可以指导我修复此错误吗?如果您确定这是因为EF,我可以重写我的上下文以直接使用ADO.NET,但我更喜欢保持它不受影响。

0 个答案:

没有答案