public class SampleContext: DbContext { public DbSet<Foo> Foos { get; set; } public DbSet<Bar> Bars { get; set; } } public class Foo { public long Id { get; set; } public virtual ICollection<Bar> Bars { get; set; } } public class Bar { public long Id { get; set; } public long FooId { get; set; } [ForeignKey("FooId")] public virtual Foo Foo { get; set; } }