nhibernate操作可能会破坏运行时的稳定性

nhibernate操作可能会破坏运行时的稳定性,nhibernate,proxy,medium-trust,Nhibernate,Proxy,Medium Trust,我的站点在本地工作,但在主机上我收到错误信息: “操作可能会使运行时不稳定。” 我用的是nhibernate。 我正在使用存储库模式 [VerificationException: Operation could destabilize the runtime.] CategoryProxy..ctor() +6 [TargetInvocationException: Exception has been thrown by the target of an invocation.]

我的站点在本地工作,但在主机上我收到错误信息:

“操作可能会使运行时不稳定。”

我用的是nhibernate。 我正在使用存储库模式

[VerificationException: Operation could destabilize the runtime.]
   CategoryProxy..ctor() +6

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +86
   System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +230
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +67
   LinFu.DynamicProxy.ProxyFactory.CreateProxy(Type instanceType, IInterceptor interceptor, Type[] baseInterfaces) +20
   NHibernate.ByteCode.LinFu.ProxyFactory.GetProxy(Object id, ISessionImplementor session) +208

[HibernateException: Creating a proxy instance failed]
   NHibernate.ByteCode.LinFu.ProxyFactory.GetProxy(Object id, ISessionImplementor session) +306

这件事以前也发生过。检查代码是否包含长switch子句。
从这里开始:

我以前也遇到过这种情况。检查代码是否包含长switch子句。
从这里开始:

使用Castle Dynamic Proxy

使用Castle Dynamic Proxy

nhibernate是巨大的,它有许多我不打算修改的switch语句:)nhibernate是巨大的,它有许多我不打算修改的switch语句:)我正在运行2.1.2GA,打开sol'n显示他们正在使用DymaicProxy 2 2.1.0.0版,在这里找不到该版本的分支:您可以在这里获得Castle DP 2.1的分支:但是为什么需要代码?获取二进制文件。我还建议获得2.2版beta版(今天发布!),但目前,您必须针对这个新版本自己构建NHibernate ProxyFactory项目。因此,Castle DynamicProxy在中信任环境下工作,而LinFu不工作?我正在运行2.1.2GA,打开sol'n显示他们使用的是dymaicproxy2 2.1.0.0版,在这里找不到它的分支:您可以在这里获得Castle DP 2.1的分支:但是为什么需要代码?获取二进制文件。我还建议获得2.2版beta版(今天发布!),但目前,您必须针对这个新版本自己构建NHibernate ProxyFactory项目。因此,Castle DynamicProxy以中等信任度工作,而LinFu没有。您使用的是Fluent吗?您使用的是Fluent吗?