Equivalent of ValidateEntity in Core3.0

ⅰ亾dé卋堺 提交于 2020-06-28 06:01:53

问题


It seems protected override DbEntityValidationResult ValidateEntity is removed from IdentityDbContext class in packages ( Microsoft.AspNetCore.Identity.EntityFrameworkCore) in latest versions (2.2.0 and 3.0)

How can I validate database in Core 3.0 or Core 2.2?


回答1:


I know that it was a long time ago but I hope it helps people with futures issues with this topic like me,

I was checking how to do it from Asp.net core 2.2 and I Found this Issue in GitHub. https://github.com/dotnet/efcore/issues/19107

The thing is that if we want to override validation we should use the specific validators that every manager has, roleValidator, userValidator, and others. in this question you can find an implementation of the roleValidator

The last reference that I found that really help me understand how does it work was by checking the source code where you can see the default validators implementation https://github.com/dotnet/aspnetcore/tree/master/src/Identity/Extensions.Core/src



来源:https://stackoverflow.com/questions/59089151/equivalent-of-validateentity-in-core3-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!