-1

I am working on a very LEGACY MVC App using C# which is built from 2009. They dont have any client side validation at all. In other words, they dont use Validation mechanism provided by MVC framework as the following link

https://docs.microsoft.com/en-us/aspnet/core/mvc/models/validation?view=aspnetcore-5.0#client-side-validation

They use service, interface etc... to do validation. Not using DataAnnotation.As a result, they dont have unit tests for Model Validator. All validation rules will be tested manually through server side only or the unit tests have strong dependency to Resource.resx or other services which I dont think they are unit tests.

Therefore, I have added a client side validation and serverside validation by using DataAnotation.

Unfortunately, my PR is declined because they said that they dont want to use or add Jquery to the current applicaton. The reason is that:

"they want to build portable micro-frontends pointing at APIs rather than all encompassing large applications the current app. because of that JQuery Validate is at the complete opposite end of the scale from zero compromise. It can be done by HTML5 and plenty of other client side only JS libraries there are plenty of better compromises. The other end of the scale (our ideal) is the validation happens in an encapsulated web component that uses Angular Forms." (An answer from a Front end developer)

The problem is that we have not the plan to replace that legacy app yet and I dont see the reason why I cannot use Validation mechanism from Microsoft to do both client side and server side validation. My thought is that it is better to do validation in correct way, rather than let it be bad and will be replaced by web-component soon. Based on the source code, I am not sure they are able to apply proper validation way in new technology because with MVC app, I think they did not apply correctly or I dont think they understand the framework.

Any ideas why I should not use MS's validation on a legacy app?

Thanks

1
  • Which part of the response from your PR does not already answer your question? The feedback reply to the PR already seems to have covered the reason why, and also mentions that there are other alternatives which they would prefer instead. Have you followed up on this with the reviewer to find out specifically which alternative(s) they would like you to use? Jul 9, 2021 at 14:09

1 Answer 1

0

There are many ways to do validation. No single way is correct. Application architecture and type of application make a big difference. The built-in validations with ASP.NET MVC work best with traditional web applications that return a form with a GET request, and redraw the form on POST-back if validation errors occur.

Judging by the feedback in your pull request, your team is not building a traditional web application. Instead, they seem to be building something more like a Single Page Application — or they might be on the process of changing the architecture so the user interface is built using multiple components, instead of one large web page.

Clearly they have determined the benefits of built-in ASP.NET MVC validations are outweighed by the benefits of splitting a monolith into smaller, more independent modules. This is reflected in the UI and how they are handling validation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.