本文整理匯總了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();
}