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


C# Impl.ManyToOneMapper类代码示例

本文整理汇总了C#中NHibernate.Mapping.ByCode.Impl.ManyToOneMapper的典型用法代码示例。如果您正苦于以下问题:C# ManyToOneMapper类的具体用法?C# ManyToOneMapper怎么用?C# ManyToOneMapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ManyToOneMapper类属于NHibernate.Mapping.ByCode.Impl命名空间,在下文中一共展示了ManyToOneMapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AssignCascadeStyle

		public void AssignCascadeStyle()
		{
			var hbmMapping = new HbmMapping();
			var hbm = new HbmManyToOne();
			var mapper = new ManyToOneMapper(null, hbm, hbmMapping);
			mapper.Cascade(Mapping.ByCode.Cascade.Persist | Mapping.ByCode.Cascade.Remove);
			hbm.cascade.Split(',').Select(w => w.Trim()).Should().Contain("persist").And.Contain("delete");
		}
开发者ID:PedroAlvarado,项目名称:nhibernate-core,代码行数:8,代码来源:ManyToOneMapperTest.cs

示例2: AutoCleanUnsupportedCascadeStyle

		public void AutoCleanUnsupportedCascadeStyle()
		{
			var hbmMapping = new HbmMapping();
			var hbm = new HbmManyToOne();
			var mapper = new ManyToOneMapper(null, hbm, hbmMapping);
			mapper.Cascade(Mapping.ByCode.Cascade.Persist | Mapping.ByCode.Cascade.DeleteOrphans | Mapping.ByCode.Cascade.Remove);
			hbm.cascade.Split(',').Select(w => w.Trim()).All(w => w.Satisfy(cascade => !cascade.Contains("orphan")));
		}
开发者ID:PedroAlvarado,项目名称:nhibernate-core,代码行数:8,代码来源:ManyToOneMapperTest.cs

示例3: CanSetAccessor

		public void CanSetAccessor()
		{
			var hbmMapping = new HbmMapping();
			var member = typeof(MyClass).GetProperty("Relation");
			var hbm = new HbmManyToOne();
			var mapper = new ManyToOneMapper(member, hbm, hbmMapping);

			mapper.Access(Accessor.ReadOnly);
			hbm.Access.Should().Be("readonly");
		}
开发者ID:PedroAlvarado,项目名称:nhibernate-core,代码行数:10,代码来源:ManyToOneMapperTest.cs

示例4: WhenSetDefaultColumnNameThenDoesNotSetTheName

		public void WhenSetDefaultColumnNameThenDoesNotSetTheName()
		{
			var hbmMapping = new HbmMapping();
			var member = typeof(MyClass).GetProperty("Relation");
			var mapping = new HbmManyToOne();
			var mapper = new ManyToOneMapper(member, mapping, hbmMapping);
			mapper.Column(cm => cm.Name("Relation"));
			mapping.column.Should().Be.Null();
			mapping.Columns.Should().Be.Empty();
		}
开发者ID:PedroAlvarado,项目名称:nhibernate-core,代码行数:10,代码来源:ManyToOneMapperTest.cs

示例5: CanSetAccessor

		public void CanSetAccessor()
		{
			var hbmMapping = new HbmMapping();
			var member = typeof(MyClass).GetProperty("Relation");
			var hbm = new HbmManyToOne();
			var mapper = new ManyToOneMapper(member, hbm, hbmMapping);

			mapper.Access(Accessor.ReadOnly);
			Assert.That(hbm.Access, Is.EqualTo("readonly"));
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:10,代码来源:ManyToOneMapperTest.cs

示例6: WhenSetDifferentColumnNameThenSetTheName

		public void WhenSetDifferentColumnNameThenSetTheName()
		{
			var hbmMapping = new HbmMapping();
			var member = typeof(MyClass).GetProperty("Relation");
			var hbm = new HbmManyToOne();
			var mapper = new ManyToOneMapper(member, hbm, hbmMapping);
			mapper.Column(cm => cm.Name("RelationId"));

			hbm.Columns.Should().Have.Count.EqualTo(1);
			hbm.Columns.Single().name.Should().Be("RelationId");
		}
开发者ID:PedroAlvarado,项目名称:nhibernate-core,代码行数:11,代码来源:ManyToOneMapperTest.cs

示例7: WhenSetBasicColumnValuesThenSetPlainValues

		public void WhenSetBasicColumnValuesThenSetPlainValues()
		{
			var hbmMapping = new HbmMapping();
			var member = typeof(MyClass).GetProperty("Relation");
			var mapping = new HbmManyToOne();
			var mapper = new ManyToOneMapper(member, mapping, hbmMapping);
			mapper.Column(cm =>
			{
				cm.UniqueKey("theUnique");
				cm.NotNullable(true);
			});
			Assert.That(mapping.Items, Is.Null);
			Assert.That(mapping.uniquekey, Is.EqualTo("theUnique"));
			Assert.That(mapping.notnull, Is.EqualTo(true));
			Assert.That(mapping.notnullSpecified, Is.EqualTo(true));
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:16,代码来源:ManyToOneMapperTest.cs

示例8: CanSetFk

		public void CanSetFk()
		{
			var hbmMapping = new HbmMapping();
			var member = typeof(MyClass).GetProperty("Relation");
			var hbm = new HbmManyToOne();
			var mapper = new ManyToOneMapper(member, hbm, hbmMapping);

			mapper.ForeignKey("MyFkName");

			hbm.foreignkey.Should().Be("MyFkName");
		}
开发者ID:PedroAlvarado,项目名称:nhibernate-core,代码行数:11,代码来源:ManyToOneMapperTest.cs

示例9: CanSetInsert

		public void CanSetInsert()
		{
			var hbmMapping = new HbmMapping();
			var member = typeof(MyClass).GetProperty("Relation");
			var hbm = new HbmManyToOne();
			var mapper = new ManyToOneMapper(member, hbm, hbmMapping);

			mapper.Insert(false);
			hbm.insert.Should().Be.False();
		}
开发者ID:PedroAlvarado,项目名称:nhibernate-core,代码行数:10,代码来源:ManyToOneMapperTest.cs

示例10: CanSetLazyness

		public void CanSetLazyness()
		{
			var hbmMapping = new HbmMapping();
			var member = typeof(MyClass).GetProperty("TheOtherRelation");
			var mapping = new HbmManyToOne();
			var mapper = new ManyToOneMapper(member, mapping, hbmMapping);
			mapper.Lazy(LazyRelation.NoProxy);
			mapping.Lazy.Should().Have.Value();
			mapping.Lazy.Should().Be(HbmLaziness.NoProxy);
		}
开发者ID:PedroAlvarado,项目名称:nhibernate-core,代码行数:10,代码来源:ManyToOneMapperTest.cs

示例11: WhenForceClassRelationToIncompatibleTypeThenThrows

		public void WhenForceClassRelationToIncompatibleTypeThenThrows()
		{
			var hbmMapping = new HbmMapping();
			var member = typeof(MyClass).GetProperty("TheOtherRelation");
			var mapping = new HbmManyToOne();
			var mapper = new ManyToOneMapper(member, mapping, hbmMapping);

			Executing.This(() => mapper.Class(typeof(Whatever))).Should().Throw<ArgumentOutOfRangeException>();
		}
开发者ID:PedroAlvarado,项目名称:nhibernate-core,代码行数:9,代码来源:ManyToOneMapperTest.cs

示例12: CanForceClassRelation

		public void CanForceClassRelation()
		{
			var hbmMapping = new HbmMapping();
			var member = typeof(MyClass).GetProperty("TheOtherRelation");
			var mapping = new HbmManyToOne();
			var mapper = new ManyToOneMapper(member, mapping, hbmMapping);

			mapper.Class(typeof(Relation));

			mapping.Class.Should().Contain("Relation").And.Not.Contain("IRelation");
		}
开发者ID:PedroAlvarado,项目名称:nhibernate-core,代码行数:11,代码来源:ManyToOneMapperTest.cs

示例13: CanSetPropertyRefName

		public void CanSetPropertyRefName()
		{
			var hbmMapping = new HbmMapping();
			var member = typeof(MyClass).GetProperty("Relation");
			var hbm = new HbmManyToOne();
			var mapper = new ManyToOneMapper(member, hbm, hbmMapping);

			mapper.PropertyRef("PropertyRefName");

			Assert.That(hbm.propertyref, Is.EqualTo("PropertyRefName"));
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:11,代码来源:ManyToOneMapperTest.cs

示例14: CanSetLazyness

		public void CanSetLazyness()
		{
			var hbmMapping = new HbmMapping();
			var member = typeof(MyClass).GetProperty("TheOtherRelation");
			var mapping = new HbmManyToOne();
			var mapper = new ManyToOneMapper(member, mapping, hbmMapping);
			mapper.Lazy(LazyRelation.NoProxy);
			Assert.That(mapping.Lazy, Is.Not.Null);
			Assert.That(mapping.Lazy, Is.EqualTo(HbmLaziness.NoProxy));
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:10,代码来源:ManyToOneMapperTest.cs

示例15: CanSetUpdate

		public void CanSetUpdate()
		{
			var hbmMapping = new HbmMapping();
			var member = typeof(MyClass).GetProperty("Relation");
			var hbm = new HbmManyToOne();
			var mapper = new ManyToOneMapper(member, hbm, hbmMapping);

			mapper.Update(false);
			Assert.That(hbm.update, Is.False);
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:10,代码来源:ManyToOneMapperTest.cs


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