When I used EF6 before, I always felt a problem, that is, when we implemented Model Binding in ASP.NET MVC, in addition to MVC will help you do input validation and model validation , when you execute db.SaveChanges();
the default Entity Framework will read the DataAnnotations
definition defined above the Entity Class again, such as [Required]
or [StringLength]
, but this is really a bit redundant. Unexpectedly, this feature has been removed since EF Core 1.0, but I only discovered this in EF Core 6.0, which shows that it is really rarely used in practice!
… continue reading …
This article is reprinted from https://blog.miniasp.com/post/2022/04/23/EF-Core-has-no-ValidateOnSaveEnabled-anymore
This site is for inclusion only, and the copyright belongs to the original author.