开发者

How to change FK Name in fluent nhibernate

I am wondering how do I change the name of a FK with fluent nhibernate.

Right now it makes all the foreign keys like (product_id,student_id) what is find but there is one table I wan开发者_JS百科t it to have a different name.

I want the courses table to have for the foreign key "MyFKName" but it keeps generating "student_id"

 public CourseMap()
    {
        Id(x => x.Id);
        References(x => x.Student).ForeignKey("MyFKName");
    }


what you are probably looking for is

public CourseMap()
{
    Id(x => x.Id);
    References(x => x.Student).KeyColumn("MyFKName");
}

ForeignKey is the name of the foreign key constraint

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜