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
精彩评论