private static IHibernateConfiguration GetTestAssemblyHibernateConfiguration(string assemblyPath)
        {
            var configuration = ConfigurationManager.OpenExeConfiguration(assemblyPath);
            var section       = configuration.GetSection(CfgXmlHelper.CfgSectionName);

            return(HibernateConfiguration.FromAppConfig(section.SectionInformation.GetRawXml()));
        }
        public override IHibernateConfiguration GetConfiguration()
        {
            ConfigurationSection configurationSection = _configuration.GetSection(CfgXmlHelper.CfgSectionName);
            var xml = configurationSection?.SectionInformation.GetRawXml();

            return(xml == null ? null : HibernateConfiguration.FromAppConfig(xml));
        }
Пример #3
0
        public static IHibernateConfiguration GetTestAssemblyHibernateConfiguration()
        {
            var assemblyPath =
                Path.Combine(TestContext.CurrentContext.TestDirectory, Path.GetFileName(typeof(TestsContext).Assembly.Location));
            var configuration = ConfigurationManager.OpenExeConfiguration(assemblyPath);
            var section       = configuration.GetSection(CfgXmlHelper.CfgSectionName);

            return(HibernateConfiguration.FromAppConfig(section.SectionInformation.GetRawXml()));
        }
Пример #4
0
        public void ByteCodeProvider()
        {
            var xml =
                @"<?xml version='1.0' encoding='utf-8' ?>
<hibernate-configuration xmlns='urn:nhibernate-configuration-2.2'>
	<bytecode-provider type='test'/>
	<session-factory>
	</session-factory>
</hibernate-configuration>";

            var hc = HibernateConfiguration.FromAppConfig(xml);

            Assert.That(hc.ByteCodeProviderType, Is.EqualTo("test"));
        }
Пример #5
0
        public void ObjectsFactory()
        {
            var xml =
                @"<?xml version='1.0' encoding='utf-8' ?>
<hibernate-configuration xmlns='urn:nhibernate-configuration-2.2'>
		<objects-factory type='test'/>
		<session-factory>
		</session-factory>
</hibernate-configuration>";

            HibernateConfiguration hc;

            using (var xtr = new XmlTextReader(xml, XmlNodeType.Document, null))
            {
                hc = new HibernateConfiguration(xtr);
                Assert.That(hc.ObjectsFactoryType, Is.Null);
            }

            hc = HibernateConfiguration.FromAppConfig(xml);
            Assert.That(hc.ObjectsFactoryType, Is.EqualTo("test"));
        }
 object IConfigurationSectionHandler.Create(object parent, object configContext, XmlNode section)
 {
     return(HibernateConfiguration.FromAppConfig(section));
 }