private void addMappings(Cfg.Configuration cfg)
        {
            var ass = Assembly.Load(TestAssembly);

            foreach (var mapping in Mappings)
            {
                cfg.AddResource(TestAssembly + "." + mapping, ass);
            }
        }
        public void ShouldThrowCorrectException()
        {
            var cfg = new Cfg.Configuration();

            cfg.Configure();
            cfg.AddResource("NHibernate.Envers.Tests.NetSpecific.UnitTests.Ids.Mapping.hbm.xml", GetType().Assembly);

            Assert.Throws <AuditException>(() => cfg.IntegrateWithEnvers());
        }
Esempio n. 3
0
        private void Configure()
        {
            cfg = new Cfg.Configuration();
            Assembly assembly = Assembly.Load(MappingsAssembly);

            Configure(cfg);

            foreach (string file in Mappings)
            {
                cfg.AddResource(MappingsAssembly + "." + file, assembly);
            }
        }
        public void Setup()
        {
            var cfg = new Cfg.Configuration();

            cfg.Configure();
            var ass = GetType().Assembly;

            cfg.AddResource("NHibernate.Envers.Tests.NetSpecific.Integration.Configuration.Inheritance.Mapping.hbm.xml", ass);
            var attrConf = new AttributeConfiguration();

            metaData = attrConf.CreateMetaData(cfg);
        }
Esempio n. 5
0
        protected override void Configure(Cfg.Configuration configuration)
        {
            var    assembly         = GetType().Assembly;
            string mappingNamespace = GetType().Namespace;

            foreach (var resource in assembly.GetManifestResourceNames())
            {
                if (resource.StartsWith(mappingNamespace) && resource.EndsWith(".hbm.xml"))
                {
                    configuration.AddResource(resource, assembly);
                }
            }
        }
        public void TestCustomLists()
        {
            var cfg = new Cfg.Configuration();

            cfg.Configure();
            cfg.AddResource("NHibernate.Envers.Tests.NetSpecific.UnitTests.CustomLists.Mapping.hbm.xml", GetType().Assembly);

            var ecfg = new FluentConfiguration();

            ecfg.Audit <AuditParent>().SetCollectionMapper <CustomCollectionMapperFactory <AuditChild> >(a => a.Children);
            ecfg.Audit <AuditChild>();

            // Throws exceptions without custon list hooks
            cfg.IntegrateWithEnvers(ecfg);
        }
        private void Configure()
        {
            cfg = new Cfg.Configuration();
            Assembly assembly = Assembly.Load(MappingsAssembly);
            Configure(cfg);

            foreach (string file in Mappings)
            {
                cfg.AddResource(MappingsAssembly + "." + file, assembly);
            }
        }