我正在尝试在同一个项目中同时使用 nhibernate 验证器和 nhibernate envers ......但我得到了空期望:
如果我稍后初始化验证器,我会收到错误消息:
Mesage: Object reference not set to an instance of an object.
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) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Event\EventListeners.cs:line 618
at NHibernate.Event.EventListeners.InitializeListeners(Configuration cfg) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Event\EventListeners.cs:line 592
at NHibernate.Cfg.Configuration.GetInitializedEventListeners() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 1189
at NHibernate.Cfg.Configuration.BuildSessionFactory() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 1246
at ....Installers.NHibernateInstaller.SessionFactoryFactory(INHibernateConfigurator nHibernateConfigurator, INHibernateEnversConfigurator nHibernateEnversConfigurator) in ...\Installers\NHibernateInstaller.cs:line 81
但如果我反过来做,我会得到错误:
Mesage: Object reference not set to an instance of an object.
StackTrace:
at NHibernate.Validator.Cfg.ValidatorInitializer.ApplyValidatorToDDL(PersistentClass persistentClass, ValidatorEngine ve)
at NHibernate.Validator.Cfg.ValidatorInitializer.Initialize(Configuration cfg, ValidatorEngine ve)
at NHibernate.Validator.Cfg.ValidatorInitializer.Initialize(Configuration cfg)
at ....NHibernateInstaller.SessionFactoryFactory(INHibernateConfigurator nHibernateConfigurator, INHibernateEnversConfigurator nHibernateEnversConfigurator) in ...\Installers\NHibernateInstaller.cs:line 83
有没有人试过这个??如何解决这个问题?
谢谢,哈里什