• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MappingSchema.HbmManyToOne类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



HbmManyToOne类属于NHibernate.Cfg.MappingSchema命名空间,在下文中一共展示了HbmManyToOne类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: SettingFormulaOverridesColumnNodes

 public void SettingFormulaOverridesColumnNodes()
 {
     var hbmMapping = new HbmMapping();
     var member = ForClass<MyClass>.Property(c => c.Relation);
     var mapping = new HbmManyToOne();
     var mapper = new ManyToOneMapper(member, mapping, hbmMapping);
     mapper.Column(cm => cm.SqlType("VARCHAR(80)"));
     mapper.Formula("formula");
     mapping.formula.Should().Be("formula");
     mapping.column.Should().Be(null);
     mapping.Items.Should().Be.Null();
 }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:12,代码来源:ManyToOneMapperWithFormulaTest.cs


示例17: Should_get_null_given_notnullSpecified_is_false_and_Items_notnullSpecified_is_false

 public void Should_get_null_given_notnullSpecified_is_false_and_Items_notnullSpecified_is_false()
 {
     HbmManyToOne manyToOne = new HbmManyToOne
         {
             notnullSpecified = false,
             Items = new object[]
                 {
                     new HbmColumn
                         {
                             notnullSpecified = false
                         }
                 }
         };
     bool? result = manyToOne.CanBeNull();
     result.ShouldBeNull();
 }
开发者ID:mvba,项目名称:hbm-to-fnh,代码行数:16,代码来源:HbmManyToOneExtensionsTests.cs


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


示例19: ManyToOneMapper

 public ManyToOneMapper(MemberInfo member, HbmManyToOne manyToOne, HbmMapping mapDoc)
 {
     this.member = member;
     this.manyToOne = manyToOne;
     this.mapDoc = mapDoc;
     if (member == null)
     {
         this.manyToOne.access = "none";
     }
     if (member == null)
     {
         entityPropertyMapper = new NoMemberPropertyMapper();
     }
     else
     {
         entityPropertyMapper = new AccessorPropertyMapper(member.DeclaringType, member.Name, x => manyToOne.access = x);
     }
 }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:18,代码来源:ManyToOneMapper.cs


示例20: BindManyToOneProperty

		private void BindManyToOneProperty(HbmManyToOne manyToOneMapping, Property property)
		{
			property.Cascade = manyToOneMapping.cascade ?? mappings.DefaultCascade;
			property.IsUpdateable = manyToOneMapping.update;
			property.IsInsertable = manyToOneMapping.insert;
			var toOne = property.Value as ToOne;
			if (toOne != null)
			{
				string propertyRef = toOne.ReferencedPropertyName;
				if (propertyRef != null)
					mappings.AddUniquePropertyReference(toOne.ReferencedEntityName, propertyRef);
				toOne.CreateForeignKey();
			}
		}
开发者ID:pruiz,项目名称:nhibernate-old,代码行数:14,代码来源:PropertiesBinder.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MappingSchema.HbmMapping类代码示例发布时间:2022-05-26
下一篇:
C# MappingSchema.HbmId类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap