Chapter 8
- With the help of database-dependent providers.
- Either by calling them
Idor by decorating them with theKeyattribute. This can also be done with fluent configuration approach. - With the
MaxLengthandMinLengthattributes. - With something similar to:
builder.Entity<Package>().HasIndex(m => m.Name);. - With something similar to:
builder.Entity<Destination>() .HasMany(m => m.Packages) .WithOne(m => m.MyDestination) .HasForeignKey(m => m.DestinationId) .OnDelete(DeleteBehavior.Cascade); - Add-Migration and Update-Database.
- No, but you can forcefully include them with the
IncludeLINQ clause or by using theUseLazyLoadingProxiesoption when configuring yourDbContext. - Yes, it is, thanks to the
SelectLINQ clause. - By calling
context.Database.Migrate().