本文整理汇总了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")));
}
示例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");
}
示例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)));
}
示例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);
}
示例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");
}
示例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();
}
示例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");
}
示例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"));
}
示例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();
}
示例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();
}
示例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;
}
示例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");
}
示例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");
}
示例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");
}
示例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();
}