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にAudit<>を追加しようとすると、この例外がスローされます。私は同様のアプリケーションを持っていますが、これは起こりません。この問題が発生する理由についての手がかりや情報はありますか?