예제 #1
0
        protected override void Configure(NHibernate.Cfg.Configuration configuration)
        {
            // The ValidatorInitializer and the ValidateEventListener share the same engine

            // Initialize the SharedEngine
            fortest = new NHibernateSharedEngineProvider();
            Cfg.Environment.SharedEngineProvider = fortest;
            ValidatorEngine ve = Cfg.Environment.SharedEngineProvider.GetEngine();

            ve.Clear();

            XmlConfiguration nhvc = new XmlConfiguration();

            nhvc.Properties[Cfg.Environment.ApplyToDDL]               = "true";
            nhvc.Properties[Cfg.Environment.AutoregisterListeners]    = "true";
            nhvc.Properties[Cfg.Environment.ValidatorMode]            = "UseAttribute";
            nhvc.Properties[Cfg.Environment.MessageInterpolatorClass] = typeof(PrefixMessageInterpolator).AssemblyQualifiedName;

            var enversConf = new FluentConfiguration();

            enversConf.Audit <Address>();
            configuration.IntegrateWithEnvers(enversConf);

            ve.Configure(nhvc);

            ValidatorInitializer.Initialize(configuration);
        }
        protected override void Configure(NHibernate.Cfg.Configuration configuration)
        {
            // The ValidatorInitializer and the ValidateEventListener share the same engine

            // Initialize the SharedEngine
            _fortest = new NHibernateSharedEngineProvider();
            Cfg.Environment.SharedEngineProvider = _fortest;
            var ve = Cfg.Environment.SharedEngineProvider.GetEngine();

            ve.Clear();
            var nhvc = new XmlConfiguration
            {
                Properties =
                {
                    [Cfg.Environment.ApplyToDDL] = "true",
                    [Cfg.Environment.AutoGenerateFromMapping]  = "true",
                    [Cfg.Environment.AutoregisterListeners]    = "true",
                    [Cfg.Environment.ValidatorMode]            = "UseAttribute",
                    [Cfg.Environment.MessageInterpolatorClass] = typeof(PrefixMessageInterpolator).AssemblyQualifiedName
                }
            };

            ve.Configure(nhvc);
            //ve.IsValid(new HibernateAnnotationIntegrationFixture.AnyClass());// add the element to engine for test

            configuration.Initialize();
        }
예제 #3
0
        private static ISharedEngineProvider BuildSharedEngine(IDictionary <string, string> properties)
        {
            string clazz;
            ISharedEngineProvider result = null;

            if (properties.TryGetValue(SharedEngineClass, out clazz))
            {
                result = (ISharedEngineProvider)Activator.CreateInstance(ReflectHelper.ClassForFullName(clazz));
            }
            return(result);
        }
예제 #4
0
        static Environment()
        {
            GlobalProperties = new Dictionary <string, string>();
            LoadGlobalPropertiesFromAppConfig();

            sharedEngineProviderInstance = BuildSharedEngine(GlobalProperties);

            if (sharedEngineProviderInstance != null)
            {
                log.Info("Using shared engine provider:" + sharedEngineProviderInstance.GetType().AssemblyQualifiedName);
            }
        }
예제 #5
0
        protected override void Configure(Configuration configuration)
        {
            // The ValidatorInitializer and the ValidateEventListener share the same engine

            // Initialize the SharedEngine
            fortest = new NHibernateSharedEngineProvider();
            Cfg.Environment.SharedEngineProvider = fortest;
            ValidatorEngine ve = Cfg.Environment.SharedEngineProvider.GetEngine();

            ve.Clear();
            XmlConfiguration nhvc = new XmlConfiguration();

            nhvc.Properties[Cfg.Environment.ApplyToDDL]               = "true";
            nhvc.Properties[Cfg.Environment.AutoregisterListeners]    = "true";
            nhvc.Properties[Cfg.Environment.ValidatorMode]            = "UseAttribute";
            nhvc.Properties[Cfg.Environment.MessageInterpolatorClass] = typeof(PrefixMessageInterpolator).AssemblyQualifiedName;
            ve.Configure(nhvc);
            ve.IsValid(new AnyClass());            // add the element to engine for test

            ValidatorInitializer.Initialize(configuration);
        }
예제 #6
0
        static Environment()
        {
            GlobalProperties = new Dictionary<string, string>();
            LoadGlobalPropertiesFromAppConfig();

            sharedEngineProviderInstance = BuildSharedEngine(GlobalProperties);

            if (sharedEngineProviderInstance != null)
            {
                log.Info("Using shared engine provider:" + sharedEngineProviderInstance.GetType().AssemblyQualifiedName);
            }
        }
        protected override void Configure(Configuration configuration)
        {
            // The ValidatorInitializer and the ValidateEventListener share the same engine

            // Initialize the SharedEngine
            fortest = new NHibernateSharedEngineProvider();
            Cfg.Environment.SharedEngineProvider = fortest;
            ValidatorEngine ve = Cfg.Environment.SharedEngineProvider.GetEngine();
            ve.Clear();
            XmlConfiguration nhvc = new XmlConfiguration();
            nhvc.Properties[Cfg.Environment.ApplyToDDL] = "true";
            nhvc.Properties[Cfg.Environment.AutoregisterListeners] = "true";
            nhvc.Properties[Cfg.Environment.ValidatorMode] = "UseAttribute";
            nhvc.Properties[Cfg.Environment.MessageInterpolatorClass] = typeof(PrefixMessageInterpolator).AssemblyQualifiedName;
            ve.Configure(nhvc);
            ve.IsValid(new AnyClass());// add the element to engine for test

            ValidatorInitializer.Initialize(configuration);
        }