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


C# MappingSchema.HbmManyToOne類代碼示例

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


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

示例1: 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

示例2: 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

示例3: AfterSetMultiColumnsCantSetSimpleColumn

 public void AfterSetMultiColumnsCantSetSimpleColumn()
 {
     var hbmMapping = new HbmMapping();
     var member = typeof(MyClass).GetProperty("Relation");
     var mapping = new HbmManyToOne();
     var mapper = new ManyToOneMapper(member, mapping, hbmMapping);
     mapper.Columns(cm => cm.Length(50), cm => cm.SqlType("VARCHAR(10)"));
     ActionAssert.Throws<ConfOrm.MappingException>(() => mapper.Column(cm => cm.Length(50)));
 }
開發者ID:alvarezdaniel,項目名稱:conformando-nhibernate,代碼行數:9,代碼來源:ManyToOneMapperTest.cs

示例4: ManyToOne

		public virtual void ManyToOne(MemberInfo property, Action<IManyToOneMapper> mapping)
		{
			if (!IsMemberSupportedByMappedContainer(property))
			{
				throw new ArgumentOutOfRangeException("property", "Can't add a property of another graph");
			}
			var hbm = new HbmManyToOne { name = property.Name };
			mapping(new ManyToOneMapper(property, hbm, MapDoc));
			AddProperty(hbm);
		}
開發者ID:marchlud,項目名稱:nhibernate-core,代碼行數:10,代碼來源:AbstractBasePropertyContainerMapper.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);
			hbm.Access.Should().Be("readonly");
		}
開發者ID:PedroAlvarado,項目名稱:nhibernate-core,代碼行數:10,代碼來源:ManyToOneMapperTest.cs

示例6: SettingColumnOverridesFormula

 public void SettingColumnOverridesFormula()
 {
     var hbmMapping = new HbmMapping();
     var member = ForClass<MyClass>.Property(c => c.Relation);
     var mapping = new HbmManyToOne();
     var mapper = new ManyToOneMapper(member, mapping, hbmMapping);
     mapper.Formula("formula");
     mapper.Column(cm => cm.Unique(true));
     mapping.formula.Should().Be.Null();
 }
開發者ID:alvarezdaniel,項目名稱:conformando-nhibernate,代碼行數:10,代碼來源:ManyToOneMapperWithFormulaTest.cs

示例7: CanSetFormula

        public void CanSetFormula()
        {
            var hbmMapping = new HbmMapping();
            var member = ForClass<MyClass>.Property(c=> c.Relation);
            var mapping = new HbmManyToOne();
            var mapper = new ManyToOneMapper(member, mapping, hbmMapping);

            mapper.Formula("SomeFormula");
            mapping.formula.Should().Be("SomeFormula");
        }
開發者ID:alvarezdaniel,項目名稱:conformando-nhibernate,代碼行數:10,代碼來源:ManyToOneMapperWithFormulaTest.cs

示例8: 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

示例9: 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

示例10: Should_get_exception_given_notnullSpecified_is_false_and_Items_is_null

 public void Should_get_exception_given_notnullSpecified_is_false_and_Items_is_null()
 {
     HbmManyToOne manyToOne = new HbmManyToOne
         {
             notnullSpecified = false,
             Items = null
         };
     bool? result = manyToOne.CanBeNull();
     result.ShouldBeNull();
 }
開發者ID:MelleKoning,項目名稱:hbm-to-fnh,代碼行數:10,代碼來源:HbmManyToOneExtensionsTests.cs

示例11: ManyToOneMapper

 public ManyToOneMapper(MemberInfo member, IAccessorPropertyMapper accessorPropertyMapper, HbmManyToOne manyToOne, HbmMapping mapDoc)
 {
     this.member = member;
     this.manyToOne = manyToOne;
     this.mapDoc = mapDoc;
     if (member == null)
     {
         this.manyToOne.access = "none";
     }
     entityPropertyMapper = member == null ? new NoMemberPropertyMapper() : accessorPropertyMapper;
 }
開發者ID:umittal,項目名稱:MunimJi,代碼行數:11,代碼來源:ManyToOneMapper.cs

示例12: SettingColumnPlainValuesOverridesFormula

 public void SettingColumnPlainValuesOverridesFormula()
 {
     var hbmMapping = new HbmMapping();
     var member = ForClass<MyClass>.Property(c => c.Relation);
     var mapping = new HbmManyToOne();
     var mapper = new ManyToOneMapper(member, mapping, hbmMapping);
     mapper.Formula("formula");
     mapper.Column("colName");
     mapping.formula.Should().Be.Null();
     mapping.column.Should().Be("colName");
 }
開發者ID:alvarezdaniel,項目名稱:conformando-nhibernate,代碼行數:11,代碼來源:ManyToOneMapperWithFormulaTest.cs

示例13: 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:alvarezdaniel,項目名稱:conformando-nhibernate,代碼行數:11,代碼來源:ManyToOneMapperTest.cs

示例14: 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

示例15: Should_get__false__given_notnullSpecified_and_notnull_are_both_true

 public void Should_get__false__given_notnullSpecified_and_notnull_are_both_true()
 {
     HbmManyToOne manyToOne = new HbmManyToOne
         {
             notnullSpecified = true,
             notnull = true
         };
     bool? result = manyToOne.CanBeNull();
     result.ShouldNotBeNull();
     result.Value.ShouldBeFalse();
 }
開發者ID:mvba,項目名稱:hbm-to-fnh,代碼行數:11,代碼來源:HbmManyToOneExtensionsTests.cs


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