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