How can I keep custom data annotations/fluent api when I scaffold -force in ef core 2.0?
Clash Royale CLAN TAG #URR8PPP How can I keep custom data annotations/fluent api when I scaffold -force in ef core 2.0? I'm using EF core 2 with existing database. Used Scaffold-DbContext command to reverse engineer classes. This worked fine. Even Fluent API has pulled through correct database field constraints etc. e.g. . . . . modelBuilder.Entity<FsReport>(entity => { entity.Property(e => e.Bcclist) .IsUnicode(false) .HasDefaultValueSql("('')"); entity.Property(e => e.Cclist) .IsUnicode(false) .HasDefaultValueSql("('')"); . . . . Problem is for 1 field I need to add a custom data annotation. If I add this, then as soon as I rerun Scaffold-DbContext -force command (e.g. if database schema change) then the annotation will be overwritten and removed. Is there anything I can do to avoid this? I tried putting it ...