当前位置: 首页>>代码示例>>C#>>正文


C# Configuration.CreateMappings方法代码示例

本文整理汇总了C#中NHibernate.Cfg.Configuration.CreateMappings方法的典型用法代码示例。如果您正苦于以下问题:C# Configuration.CreateMappings方法的具体用法?C# Configuration.CreateMappings怎么用?C# Configuration.CreateMappings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NHibernate.Cfg.Configuration的用法示例。


在下文中一共展示了Configuration.CreateMappings方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateCfg

 public static Configuration CreateCfg()
 {
     Configuration cfg = new Configuration();
     cfg.Properties[NHibernate.Cfg.Environment.Dialect] = typeof(NHibernate.Dialect.GenericDialect).FullName;
     cfg.AddAssembly(typeof(MyEntity).Assembly);
     cfg.CreateMappings(new NHibernate.Dialect.GenericDialect());
     return cfg;
 }
开发者ID:mausch,项目名称:NHWorkbench,代码行数:8,代码来源:BasicTests.cs

示例2: AddTypeDef

		public void AddTypeDef()
		{
			var configure = new Configuration()
				.DataBaseIntegration(db => db.Dialect<MsSql2005Dialect>());
			configure.TypeDefinition<TableHiLoGenerator>(c=>
			                                             	{
			                                             		c.Alias = "HighLow";
			                                             		c.Properties = new {max_lo = 99};
			                                             	});
			var mappings = configure.CreateMappings(Dialect.Dialect.GetDialect(configure.Properties));
			var typeDef = mappings.GetTypeDef("HighLow");
			Assert.That(typeDef, Is.Not.Null);
			Assert.That(typeDef.Parameters["max_lo"], Is.EqualTo("99"));
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:14,代码来源:TypeDefinitionFixture.cs

示例3: Main

        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var cfg = new Configuration();
            cfg.Properties[Environment.Dialect] = typeof(GenericDialect).FullName;
            cfg.Properties[Environment.ProxyFactoryFactoryClass] =
                "NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle";
            cfg.AddAssembly(typeof(MyEntity).Assembly);
            cfg.CreateMappings(new GenericDialect());

            var visualizerHost = new VisualizerDevelopmentHost(
                cfg, typeof(CfgVisualizer));
            visualizerHost.ShowVisualizer();
        }
开发者ID:tvbusy,项目名称:HbnCfgVisualizer,代码行数:16,代码来源:Program.cs

示例4: WhenMapHiloToDifferentSchemaThanClassThenIdHasTheMappedSchema

		public void WhenMapHiloToDifferentSchemaThanClassThenIdHasTheMappedSchema()
		{
			var mapper = new ModelMapper();
			mapper.Class<MyClass>(cm =>
			                      {
															cm.Schema("aSchema");
															cm.Id(x => x.Id, idm => idm.Generator(Generators.HighLow, gm => gm.Params(new
															                                                                          {
															                                                                          	table = "hilosequences",
															                                                                          	schema="gSchema"
															                                                                          })));
			                      });
			var conf = new Configuration();
			conf.DataBaseIntegration(x=> x.Dialect<MsSql2008Dialect>());
			conf.AddDeserializedMapping(mapper.CompileMappingForAllExplicitAddedEntities(), "wholeDomain");

			var mappings = conf.CreateMappings(Dialect.Dialect.GetDialect());
			var pc = mappings.GetClass(typeof(MyClass).FullName);
			((SimpleValue)pc.Identifier).IdentifierGeneratorProperties["schema"].Should().Be("gSchema");
		}
开发者ID:pontillo,项目名称:PowerNap,代码行数:20,代码来源:Fixture.cs

示例5: VerifyMapping

		private void VerifyMapping(HbmMapping mapping)
		{
			var dialect = new MsSql2008Dialect();
			var configuration = new Configuration();
			var mappings = configuration.CreateMappings(dialect);
			mappings.DefaultAssembly = "NHibernate.Test";
			mappings.DefaultNamespace = "NHibernate.Test.NHSpecificTest.NH1007";

			var rootBinder = new MappingRootBinder(mappings, dialect);
			rootBinder.Bind(mapping);

			var employer = rootBinder.Mappings.GetClass("NHibernate.Test.NHSpecificTest.NH1007.Employer1");
			var simpleValue = employer.Identifier as SimpleValue;
			if (simpleValue != null)
			{
				Assert.That(simpleValue.IdentifierGeneratorStrategy, Is.EqualTo("guid"));
				Assert.That(simpleValue.IdentifierGeneratorProperties, Is.Empty);
			}
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:19,代码来源:Fixture.cs


注:本文中的NHibernate.Cfg.Configuration.CreateMappings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。