With Entity Framework we had HasRequired
on a field. What is the alternative replacement for that with EF core?
https://msdn.microsoft.com/en-us/library/jj591620(v=vs.113).aspx
I tried with HasRequired
but it throws error.
Check out the Required and Optional Relationships in the EF Core Documentation.
Specifically I think you'll want something like:
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<MyEntity>()
.HasOne(p => p.Relationship)
.IsRequired();
}
Or something like that - you haven't given much information to go on