Hope this is still on time to help you. I was also having the exact same problem and was troubling with it for almost an hour until I could spot my mistake.
The problem is that Course.Venue
relationship is optional (as declared on the fluent API), but the Id declaration of Course.VenueId
is mandatory, so you can either make VenueId optional by changing it to
public int? VenueId { get; set;}
or change the relationship to mandatory on the fluent API, and the OnModelCreating should run fine once you changed that.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…