EF Code First Fluent API specifying the Foreign Key property

后端 未结 2 450
滥情空心
滥情空心 2020-12-14 00:02

I have a class AgentBalance with an association to Agent, thus:

public class AgentBalance
{
    ...

    public int AgentId { get; set; }

    public virtual         


        
2条回答
  •  半阙折子戏
    2020-12-14 01:03

    I believe you should be able to do this:

    HasRequired(t => t.Agent).WithMany().HasForeignKey(t => t.AgentId)
    

提交回复
热议问题