I have a class AgentBalance with an association to Agent, thus:
public class AgentBalance
{
...
public int AgentId { get; set; }
public virtual
I prefer to use Data Annotations for these tasks, not Fluent API. It is much shorter end easy to understand. EF must detect properties ended with "Id" automatically, but to be on a safe side you can specify them explicitly:
using System.ComponentModel.DataAnnotations.Schema;
...
public int AgentId { get; set; }
[ForeignKey("AgentId")]
public virtual Agent Agent { get; set; }
You will need to specify them explicitly if your FK prop are not ended with "Id", for example:
public int AgentCode { get; set; }
[ForeignKey("AgentCode")] // now this is needed if you'd like to have FK created
public virtual Agent Agent { get; set; }
You can find more details here: https://msdn.microsoft.com/en-us/data/jj591583.aspx
I believe you should be able to do this:
HasRequired(t => t.Agent).WithMany().HasForeignKey(t => t.AgentId)