使用NHibernate和Breeze的OneTONE映射
是否可以使用breeze和NHibernate使其工作:使用NHibernate和Breeze的OneTONE映射,breeze,Breeze,是否可以使用breeze和NHibernate使其工作: public class PeopleMap: BaseMapping<People> { public PeopleMap() { this.Property(x => x.FirstName); this.Property(x => x.LastName); } } public class PersonMap : JoinedSubclassMappin
public class PeopleMap: BaseMapping<People>
{
public PeopleMap()
{
this.Property(x => x.FirstName);
this.Property(x => x.LastName);
}
}
public class PersonMap : JoinedSubclassMapping<Person>
{
public PersonMap()
{
this.Key(p=>p.Column("ID"));
this.Property(x => x.FirstName);
this.Property(x => x.LastName);
this.Property(x => x.InfoId, map =>
{
map.Insert(false);
map.Update(false);
}
);
this.ManyToOne(x => x.Info, map =>
{
map.Cascade(Cascade.All);
map.Column("InfoId");
});
}
public class PersonInfoMap : BaseMapping<PersonInfo>
{
public PersonInfoMap()
{
this.Property(x => x.Extra);
this.OneToOne(x => x.Person, map =>
{
map.Constrained(true);
map.PropertyReference(p => p.Info);
});
}
}
结果是异常,因为Person实体保存在PersonInfo之前(外键异常)。我在示例中看到了Order和InternationalLorder的一对一,但在该示例中,两个实体共享相同的主键
是否可能,或者是否存在订单/国际订单示例中的解决方法?您是否查看了
请做。。。如果找不到要查找的内容,请返回报告。我尝试了这些示例,但效果不理想(尝试扩展意向订单不起作用oob)。我将从你家里做一个工作示例,因为我认为我们遇到了一个边缘案例(与继承和一对一相关)。谢谢你!我们期待着您的复述。
var d = breezeService.manager.createEntity('Person',
{
FirstName: 'Laurent',
LastName: 'Nullens'
});
var l = breezeService.manager.createEntity('PersonInfo',
{
Extra: 'First data',
Person: d
});
d.Info = l;