[问:]是否有可能使用FK作为EF中的鉴别器,人们想出了哪些变通方法?
public class List
{
public int Id { get; set; }
public string Name { get; set; }
public ICollection<ListItem> Items { get; set; }
}
public abstract class ListItem
{
public int Id { get; set; }
public List List { get; set; }
public string Text { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
EF专用(即无法更改)未使用的现有DB 具有以下字段:
List
Id int not null (identity)
Name varchar
ListItem
Id int not null (identity)
ListId int not null (FK to …Run Code Online (Sandbox Code Playgroud)