以下のパターンの時に、外部キーと認識される
<navigation property name><principal key property name>
<navigation property name>Id
<principal entity name><principal key property name>
<principal entity name>Id
このパターン以外の場合は、ForeignKeyAttributeを使う。
public class Blog
{
public int BlogId { get; set; }
public string Url { get; set; }
public List<Post> Posts { get; set; }
}
public class Post
{
public int PostId { get; set; }
public string Title { get; set; }
public string Content { get; set; }
public int BlogFKey { get; set; }
[ForeignKey(nameof(BlogFKey))]
public Blog Blog { get; set; }
}