流畅的配置异常
Fluent Configuration Exception
if (_cacheSessionFactory == null)
{
Configuration config = null;
_cacheSessionFactory = ReadOrBuildConfiguration().ExposeConfiguration(
cfg =>
{
SetSessionContext(cfg);
cfg.SetListener(ListenerType.Flush, new PostFlushFixEventListener());
ConfigureValidator(cfg);
if (EnversConfiguration != null)
{
cfg.SetEnversProperty(ConfigurationKey.StoreDataAtDelete, true);
cfg.IntegrateWithEnvers(EnversConfiguration);
}
}).ExposeConfiguration(cfg => { config = cfg; }).BuildSessionFactory();
using (_cacheSessionFactory.OpenSession())
{
BuildSchema(config);
}
}
已更新 堆栈跟踪
FluentNHibernate.Cfg.FluentConfigurationException was unhandled by user code
HResult=-2146233088
Message=An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
* Database was not configured through Database method.
* No mappings were configured through the Mappings method.
Source=FluentNHibernate
StackTrace:
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
at NhibDataAccess.NhibernateSetup.CreateSessionFactory() in d:\Jorell\PROJECTS\NhibDataAccess\NhibernateSetup.cs:line 105
at NhibDataAccess.NhibernateSetup.get_SessionFactory() in d:\Jorell\PROJECTS\NhibDataAccess\NhibernateSetup.cs:line 67
at NhibDataAccess.UnitOfWork.LongRunningUnitOfWork.get_SessionFactory() in d:\Jorell\PROJECTS\NhibDataAccess\UnitOfWork\LongRunningUnitOfWork.cs:line 63
at Web.Global.Application_EndRequest(Object sender, EventArgs e) in d:\Jorell\PROJECTS\Web\Global.asax.cs:line 54
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
InnerException: System.NullReferenceException
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=NHibernate.Validator
StackTrace:
at NHibernate.Validator.Engine.SystemTypeExtensions.ShouldNeedValidation(Type clazz)
at NHibernate.Validator.Engine.ValidatorEngine.GetClassValidator(Type entityType)
at NHibernate.Validator.Engine.ValidatorEngine.AddValidator(Type entityType, IValidatableSubElementsInspector inspector)
at NHibernate.Validator.Event.ValidatePreInsertEventListener.Initialize(Configuration cfg)
at NHibernate.Event.EventListeners.InitializeListeners(Configuration cfg, Object[] list)
at NHibernate.Event.EventListeners.InitializeListeners(Configuration cfg)
at NHibernate.Cfg.Configuration.GetInitializedEventListeners()
at NHibernate.Cfg.Configuration.BuildSessionFactory()
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
InnerException:
当我尝试在 EnversConfiguration[=22= 中添加任何 Audit<> 时]抛出这个异常。我有一个类似的应用程序,但没有发生。关于为什么会出现此问题的任何线索或信息?
我的代码中的问题在我知道之前就已经解决了。
请访问该站点以获取更多信息
if (_cacheSessionFactory == null)
{
Configuration config = null;
_cacheSessionFactory = ReadOrBuildConfiguration().ExposeConfiguration(
cfg =>
{
SetSessionContext(cfg);
cfg.SetListener(ListenerType.Flush, new PostFlushFixEventListener());
ConfigureValidator(cfg);
if (EnversConfiguration != null)
{
cfg.SetEnversProperty(ConfigurationKey.StoreDataAtDelete, true);
cfg.IntegrateWithEnvers(EnversConfiguration);
}
}).ExposeConfiguration(cfg => { config = cfg; }).BuildSessionFactory();
using (_cacheSessionFactory.OpenSession())
{
BuildSchema(config);
}
}
已更新 堆栈跟踪
FluentNHibernate.Cfg.FluentConfigurationException was unhandled by user code
HResult=-2146233088
Message=An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
* Database was not configured through Database method.
* No mappings were configured through the Mappings method.
Source=FluentNHibernate
StackTrace:
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
at NhibDataAccess.NhibernateSetup.CreateSessionFactory() in d:\Jorell\PROJECTS\NhibDataAccess\NhibernateSetup.cs:line 105
at NhibDataAccess.NhibernateSetup.get_SessionFactory() in d:\Jorell\PROJECTS\NhibDataAccess\NhibernateSetup.cs:line 67
at NhibDataAccess.UnitOfWork.LongRunningUnitOfWork.get_SessionFactory() in d:\Jorell\PROJECTS\NhibDataAccess\UnitOfWork\LongRunningUnitOfWork.cs:line 63
at Web.Global.Application_EndRequest(Object sender, EventArgs e) in d:\Jorell\PROJECTS\Web\Global.asax.cs:line 54
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
InnerException: System.NullReferenceException
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=NHibernate.Validator
StackTrace:
at NHibernate.Validator.Engine.SystemTypeExtensions.ShouldNeedValidation(Type clazz)
at NHibernate.Validator.Engine.ValidatorEngine.GetClassValidator(Type entityType)
at NHibernate.Validator.Engine.ValidatorEngine.AddValidator(Type entityType, IValidatableSubElementsInspector inspector)
at NHibernate.Validator.Event.ValidatePreInsertEventListener.Initialize(Configuration cfg)
at NHibernate.Event.EventListeners.InitializeListeners(Configuration cfg, Object[] list)
at NHibernate.Event.EventListeners.InitializeListeners(Configuration cfg)
at NHibernate.Cfg.Configuration.GetInitializedEventListeners()
at NHibernate.Cfg.Configuration.BuildSessionFactory()
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
InnerException:
当我尝试在 EnversConfiguration[=22= 中添加任何 Audit<> 时]抛出这个异常。我有一个类似的应用程序,但没有发生。关于为什么会出现此问题的任何线索或信息?
我的代码中的问题在我知道之前就已经解决了。 请访问该站点以获取更多信息