protected override void Configure(NHibernate.Cfg.Configuration configuration) { // The ValidatorInitializer and the ValidateEventListener share the same engine // Initialize the SharedEngine fortest = new NHibernateSharedEngineProvider(); Environment.SharedEngineProvider = fortest; ValidatorEngine ve = Environment.SharedEngineProvider.GetEngine(); ve.Clear(); XmlConfiguration nhvc = new XmlConfiguration(); nhvc.Properties[Environment.ApplyToDDL] = "true"; nhvc.Properties[Environment.AutoregisterListeners] = "true"; nhvc.Properties[Environment.ValidatorMode] = "useExternal"; nhvc.Properties[Environment.MessageInterpolatorClass] = typeof(PrefixMessageInterpolator).AssemblyQualifiedName; ve.Configure(nhvc); ve.IsValid(new AnyClass()); // add the element to engine for test ValidatorInitializer.Initialize(configuration); }
private void InitializeValidator() { var provider = new NHibernateSharedEngineProvider(); NHibernate.Validator.Cfg.Environment.SharedEngineProvider = provider; }