Given this extremely simple model:
public class MyContext : BaseContext
{
public DbSet Foos { get; set; }
public DbSet Bars { g
Ok, here is the real answer =)
if you have a property (like your Bar) noting a FK (ForeignKey), you can also have the corresponding FK field in your model so if we only need the FK and not the actual Bar we don't need it to go to the database:
[ForeignKey("BarId")]
public virtual Bar Bar { get; set; }
public int BarId { get; set; }
Now, to answer your question, what you can do to make the Bar as Required is to flag the BarId property as required, but not the Bar itself:
[ForeignKey("BarId")]
public virtual Bar Bar { get; set; }
[Required] //this makes the trick
public int BarId { get; set; }
this works like a charm =)