當前位置: 首頁>>代碼示例>>C#>>正文


C# MappingSchema.HbmMapping類代碼示例

本文整理匯總了C#中NHibernate.Cfg.MappingSchema.HbmMapping的典型用法代碼示例。如果您正苦於以下問題:C# HbmMapping類的具體用法?C# HbmMapping怎麽用?C# HbmMapping使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HbmMapping類屬於NHibernate.Cfg.MappingSchema命名空間,在下文中一共展示了HbmMapping類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AfterBuildMappings

 /// <summary>
 /// Allows to execute custom code after the given mapping document is built
 /// </summary>
 /// <param name="mapping">The mapping doc</param>
 public override void AfterBuildMappings(HbmMapping mapping)
 {
     if (AfterBuildMappingsDelegate != null)
     {
         AfterBuildMappingsDelegate(mapping);
     }
 }
開發者ID:HomeroThompson,項目名稱:firehawk,代碼行數:11,代碼來源:TestExtension.cs

示例2: WhenSetSyncMixedWithNullAndEmptyThenAddOnlyValid

		public void WhenSetSyncMixedWithNullAndEmptyThenAddOnlyValid()
		{
			var mapdoc = new HbmMapping();
			var rc = new UnionSubclassMapper(typeof(InheritedSimple), mapdoc);
			rc.Synchronize("", "  ATable   ", "     ", null);
			mapdoc.UnionSubclasses[0].Synchronize.Single().table.Should().Be("ATable");
		}
開發者ID:owerkop,項目名稱:nhibernate-core,代碼行數:7,代碼來源:TablesSincronizationTests.cs

示例3: MapTypes

		public virtual void MapTypes(List<Type> allTypes, NHibernate.Cfg.Configuration cfg, Func<string, string> formatter)
		{
			var m = new HbmMapping();
			m.Items = allTypes.Select(t =>
				{
					var sc = new HbmSubclass();
					sc.name = GetName(t);
					sc.extends = GetName(t.BaseType);
					sc.discriminatorvalue = map.GetOrCreateDefinition(t).Discriminator ?? t.Name;
					sc.lazy = false;
					sc.lazySpecified = true;

					var propertyMappings = GetPersistables(t)
						.Select(p => p.Attribute.GetPropertyMapping(p.DeclaringProperty, formatter))
						.ToList();
					if (propertyMappings.Count > 0)
					{
						if (sc.Items == null)
							sc.Items = propertyMappings.ToArray();
						else
							sc.Items = sc.Items.Union(propertyMappings).ToArray();
					}
					logger.DebugFormat("Generating subclass {0} with discriminator {1} extending {2} with {3} items ({4} property mappings)", sc.name, sc.discriminatorvalue, sc.extends, sc.Items != null ? sc.Items.Length.ToString() : "(null)", propertyMappings.Count);
					return sc;
				}).ToArray();
			if (Debugger.IsAttached)
			{
				var dbg = m.AsString();
			}
			cfg.AddDeserializedMapping(m, "N2");
		}
開發者ID:navneetccna,項目名稱:n2cms,代碼行數:31,代碼來源:ClassMappingGenerator.cs

示例4: ComponentMapper

		public ComponentMapper(HbmComponent component, Type componentType, MemberInfo declaringTypeMember, HbmMapping mapDoc)
			: base(componentType, mapDoc)
		{
			this.component = component;
			[email protected] = componentType.GetShortClassName(mapDoc);
			accessorPropertyMapper = new AccessorPropertyMapper(declaringTypeMember.DeclaringType, declaringTypeMember.Name, x => component.access = x);
		}
開發者ID:Mrding,項目名稱:Ribbon,代碼行數:7,代碼來源:ComponentMapper.cs

示例5: WhenCreateThenSetDefaultTableName

		public void WhenCreateThenSetDefaultTableName()
		{
			var mapdoc = new HbmMapping();
			var hbmJoin = new HbmJoin();
			new JoinMapper(typeof(MyClass), "   AA   ", hbmJoin, mapdoc);
			hbmJoin.table.Should().Be("AA");
		}
開發者ID:owerkop,項目名稱:nhibernate-core,代碼行數:7,代碼來源:JoinMapperTests.cs

示例6: Add

		public void Add(HbmMapping document)
		{
			if (document == null)
				throw new ArgumentNullException("document");

			documents.Add(document);
		}
開發者ID:marchlud,項目名稱:nhibernate-core,代碼行數:7,代碼來源:MappingDocumentAggregator.cs

示例7: CanSetPersister

		public void CanSetPersister()
		{
			var mapdoc = new HbmMapping();
			var rc = new ClassMapper(typeof(EntitySimple), mapdoc, For<EntitySimple>.Property(x => x.Id));
			rc.Persister<SingleTableEntityPersister>();
			mapdoc.RootClasses[0].Persister.Should().Contain("SingleTableEntityPersister");
		}
開發者ID:owerkop,項目名稱:nhibernate-core,代碼行數:7,代碼來源:SetPersisterTests.cs

示例8: WhenSetMoreSyncThenAddAll

		public void WhenSetMoreSyncThenAddAll()
		{
			var mapdoc = new HbmMapping();
			var rc = new ClassMapper(typeof(EntitySimple), mapdoc, For<EntitySimple>.Property(x => x.Id));
			rc.Synchronize("T1", "T2", "T3", null);
			mapdoc.RootClasses[0].Synchronize.Select(x => x.table).Should().Have.SameValuesAs("T1", "T2", "T3");
		}
開發者ID:owerkop,項目名稱:nhibernate-core,代碼行數:7,代碼來源:TablesSincronizationTests.cs

示例9: CallSetCache

 public void CallSetCache()
 {
     var mapdoc = new HbmMapping();
     var rc = new ClassMapper(typeof(EntitySimple), mapdoc, typeof(EntitySimple).GetProperty("Id"));
     rc.Cache(ch=> ch.Region("pizza"));
     mapdoc.RootClasses[0].cache.Should().Not.Be.Null();
 }
開發者ID:alvarezdaniel,項目名稱:conformando-nhibernate,代碼行數:7,代碼來源:ClassMapperTest.cs

示例10: AtCreationSetIdType

		public void AtCreationSetIdType()
		{
			var hbmMapping = new HbmMapping();
			var hbmAny = new HbmAny();
			new AnyMapper(null, typeof(int), hbmAny, hbmMapping);
			Assert.That(hbmAny.idtype, Is.EqualTo("Int32"));
		}
開發者ID:marchlud,項目名稱:nhibernate-core,代碼行數:7,代碼來源:AnyMapperTest.cs

示例11: AssignsNHibernateMappingSchema

 public void AssignsNHibernateMappingSchema()
 {
     var mapping = new HbmMapping();
     var serializer = new MappingXmlSerializer();
     XmlDocument document = serializer.Serialize(mapping);
     Assert.That(document.Schemas.Contains("urn:nhibernate-mapping-2.2"));
 }
開發者ID:paulbatum,項目名稱:Fluent-NHibernate-Semantic-Model-Rewrite,代碼行數:7,代碼來源:MappingXmlSerializerTester.cs

示例12: BeforeBuildMappings

 /// <summary>
 /// Allows to execute custom code before the given mapping document is built
 /// </summary>
 /// <param name="mapping">The mapping doc</param>
 public override void BeforeBuildMappings(HbmMapping mapping)
 {
     if (BeforeBuildMappingsDelegate != null)
     {
         BeforeBuildMappingsDelegate(mapping);
     }
 }
開發者ID:HomeroThompson,項目名稱:firehawk,代碼行數:11,代碼來源:TestExtension.cs

示例13: AfterCompileMappings

 /// <summary>
 /// Allows to execute custom code after the entity types were compiled to the given mapping document
 /// </summary>
 /// <param name="entityTypes">The entity types</param>
 public override void AfterCompileMappings(IList<Type> entityTypes, HbmMapping mapping)
 {
     if (AfterCompileMappingsDelegate != null)
     {
         AfterCompileMappingsDelegate(entityTypes, mapping);
     }
 }
開發者ID:HomeroThompson,項目名稱:firehawk,代碼行數:11,代碼來源:TestExtension.cs

示例14: CanSetPersister

		public void CanSetPersister()
		{
			var mapdoc = new HbmMapping();
			var rc = new UnionSubclassMapper(typeof(InheritedSimple), mapdoc);
			rc.Persister<UnionSubclassEntityPersister>();
			Assert.That(mapdoc.UnionSubclasses[0].Persister, Is.StringContaining("UnionSubclassEntityPersister"));
		}
開發者ID:marchlud,項目名稱:nhibernate-core,代碼行數:7,代碼來源:SetPersisterTests.cs

示例15: CallSetDiscriminator

 public void CallSetDiscriminator()
 {
     var mapdoc = new HbmMapping();
     var rc = new ClassMapper(typeof(EntitySimple), mapdoc, typeof(EntitySimple).GetProperty("Id"));
     rc.DiscriminatorValue("X");
     mapdoc.RootClasses[0].discriminator.Should().Not.Be.Null();
 }
開發者ID:alvarezdaniel,項目名稱:conformando-nhibernate,代碼行數:7,代碼來源:ClassMapperTest.cs


注:本文中的NHibernate.Cfg.MappingSchema.HbmMapping類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。