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