-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrating with ASP.NET Core #148
Comments
Yes, that kind of middleware would be great! I will be happy to help. |
@paw3lx great! We'll need to find out how to implement that :D |
As far as I understand we need to create our custom services.AddMvc(options => options.ModelValidatorProviders.Add(...)); I found internal implementation for the data annotations on GitHub: This won't be a simple task, but we should nailed this anyway :D |
All right, after short break I finally got back to the project and I started doing this task localy. Surprisingly, I got first, working prototype done fairly quickly (about 30 minutes), so it's not that hard as I thought. However there are two issues that we need to overcome somehow:
|
Since the Valit.Examples repo was empty I put there my prototype with example integration. Of course it works just for specific type but at least we'll know the direction of this integration :D |
I think that having the very solid Core library, we should start thinking about some integration projects and here comes the first one. I thought about creating new NuGet for the ASP.NET Core apps. The idea is simple, allow folks to kick off the validation before we start processing the particular action in the MVC6 controller, so the could use
ModelState
object to see the result (just like it was achieved before using the attributes). So to me the whole process should look as follows:Model
typeModelValitator
is created for typeStartup
we register of valitators autmatically usingUseValit()
extensionThat would be awesome 👍
The text was updated successfully, but these errors were encountered: