Where do you store validation logic?

I play with the MVC.Validation Toolkit . The goal is to use the same validation rules in the client script and in the server code.

However, I continue to create new poco classes for everything. I have one class from linq2entities, then I got one class that is passed from the datalayer to the business layer and then to the controller. And I have another viewmodel class to pass data to the view.

I cannot find a way around this last class, since I need to use different validation rules at different times.

Validation attributes are defined in the view model class. This is not the best way.

Does anyone have experience using this toolkit?

+4
source share
1 answer

You will probably want to check out this tutorial and see if it really is http://www.asp.net/learn/mvc/tutorial-37-cs.aspx

The main thing is that you can implement IDataErrorInfo with your model class that mvc knows about.

+2
source

All Articles