ASP.NET Core Web API + EF Core - Recommended way to check all unique constraints on a POST?
I've just started trying out EF Core and have ran into something that google doesn't immediately answer.
If you let VS auto create an API Controller with actions using Entity Framework, most of the methods check for things like if the record exists before deleting it. However, for POST requests, if you try to add a model with a duplicate for any existing unique column you get an internal server error.
What's the recommended way for checking all unique constraints and returning a 'nice' error?
0 comments:
Post a Comment