You must explicitly specify a foreign key, annotations on navigation properties do not work at all.
[Index("MetaPeriodDateUnq", IsUnique = true, Order = 2)]
public DateTime Date { get; set; }
[Index("MetaPeriodDateUnq", IsUnique = true, Order = 1)]
public Guid PeriodId { get; set; }
public virtual PeriodType Period { get; set; }
This should work (not verified).
source
share