EF Code First CTP5 - Using the name of the property as column name for foreign key

后端 未结 2 737
渐次进展
渐次进展 2021-01-06 08:12

Given the following model:

public class Foo
{
    public int Id { get; set;}
    public Bar TheBar { get; set; }
}

public class Bar
{
    public int Id { ge         


        
2条回答
  •  梦毁少年i
    2021-01-06 09:04

    You want the MapKey method in the fluent interface.

    Alternately, if you do this throughout your model, CTP 5 has pluggable conventions, although this is, AFAIK, not well-documented yet.

提交回复
热议问题