在中等信任环境中使用 Unity + Fluent NHibernate + NHibernate 3.3.1.4
var session = sessionFactory.OpenSession();
返回此错误:
Attempt by method 'NHibernate.AdoNet.SqlClientSqlCommandSet..ctor()' to access method 'System.Data.SqlClient.SqlCommandSet..ctor()' failed.
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at NHibernate.AdoNet.SqlClientSqlCommandSet..ctor()
at NHibernate.AdoNet.SqlClientBatchingBatcher.CreateConfiguredBatch()
at NHibernate.AdoNet.SqlClientBatchingBatcher..ctor(ConnectionManager connectionManager, IInterceptor interceptor)
at NHibernate.AdoNet.SqlClientBatchingBatcherFactory.CreateBatcher(ConnectionManager connectionManager, IInterceptor interceptor)
at NHibernate.AdoNet.ConnectionManager..ctor(ISessionImplementor session, IDbConnection suppliedConnection, ConnectionReleaseMode connectionReleaseMode, IInterceptor interceptor)
at NHibernate.Impl.SessionImpl..ctor(IDbConnection connection, SessionFactoryImpl factory, Boolean autoclose, Int64 timestamp, IInterceptor interceptor, EntityMode entityMode, Boolean flushBeforeCompletionEnabled, Boolean autoCloseSessionEnabled, ConnectionReleaseMode connectionReleaseMode)
at NHibernate.Impl.SessionFactoryImpl.OpenSession(IDbConnection connection, Boolean autoClose, Int64 timestamp, IInterceptor sessionLocalInterceptor)
at NHibernate.Impl.SessionFactoryImpl.OpenSession(IInterceptor sessionLocalInterceptor)
at NHibernate.Impl.SessionFactoryImpl.OpenSession()
at BsCms.Bootstrapper.<>c__DisplayClass5.<BuildUnityContainer>b__2(IUnityContainer c)
at Microsoft.Practices.Unity.InjectionFactory.<>c__DisplayClass2.<.ctor>b__0(IUnityContainer c, Type t, String s)
at Microsoft.Practices.ObjectBuilder2.FactoryDelegateBuildPlanPolicy.BuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
有人能帮我吗?