當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。