ModelState.IsValid even when it should not be?

前端 未结 10 1368
说谎
说谎 2020-11-29 03:14

I have API where I need to validate my user model. I choose an approach where I create different classes for Create/Edit actions to avoid mass-assignment and divide validati

10条回答
  •  心在旅途
    2020-11-29 03:52

    Try

    services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
    

    in the startup.cs file's ConfigureServices()

提交回复
热议问题