开发者

Mapping non-conventional FK column in Fluent NHibernate

I have a User class and a Workflow class. A Workflow has a User property on it, relating to the user who created the workflow.

I thi开发者_JS百科nk I mostly get the basics of Fluent NHibernate now, and have modified the FK convention so the FK field it expects on the Workflow table has a UserId column rather than a User_id column.

All great.

However, I'd like to rename Workflow.User to better illustrate the intent so it becomes Workflow.CreatedByUser.

My FK convention seems to work out the correct property name: CreatedByUserId, and I've been through the hassle of "transient" objects that need saving via Cascade.All(), but now I'm getting exceptions because the Workflow.CreatedByUserId column is NOT NULL, but NH isn't, for some reason, finding a value to put in it. I therefore get a SqlException.

What am I missing?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜