开发者

Composite keys fluent nhibernate

开发者 https://www.devze.com 2023-02-27 01:44 出处:网络
Can one do this on 开发者_StackOverflow社区a fluent nhibernate ? When I try to save, I am profiding the profile and the scenario objects and the id\'s are not null.

Can one do this on 开发者_StackOverflow社区a fluent nhibernate ?

When I try to save, I am profiding the profile and the scenario objects and the id's are not null.

Nhibernate complains that it can't insurt NULL for ProfileID column. Fluent Nhibernate doesn't know how to get to the Profile.ID ?

CompositeId().KeyProperty(x => x.Profile.ID, "ProfileID").KeyProperty(x => x.Scenario.ID, "ScenarioID");


You should probably use this instead:

CompositeId()
    .KeyReference(x => x.Profile, "ProfileID")
    .KeyReference(x => x.Scenario, "ScenarioID");
0

精彩评论

暂无评论...
验证码 换一张
取 消