当前位置: 首页>>代码示例>>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;未经允许,请勿转载。