asp.net mvc - Is Data Annotations really a good idea for validation? -


As I am learning as much about asp.net MVC and I have been introduced for data annotation .
In particular, they are used for verification in MVC and it gives me some concerns.
The biggest fact is that I would like to keep my model as POCOs and clean as much as possible.
Now, if I have those model classes, a solution (i.e. web front end, desktop app, web services) is shared in many projects?
Actually I am worried that specific annotations for my MVC front end app can affect some other projects like dynamic data etc. My Business Objects are different from my database model (in this case LINQ2SQL), so I do not care about the impact of annotation on my DAL, but I am thinking that my fear about other projects is valid.

In addition to this, I feel that writing a typical error message to your model is a bit crazy.

I think the problem will be solved if I use every project (web, desktop, web service , Etc.) but it will actually be a direct copy of my existing shared model. Is this the right way?
There will be a big impact on my solution (one more model is happening).

What do you think?
I would like to hear what you think about the good and bad use of data annotations.

I find data annotations convenient for such models, where the rules are based on an email address such as references But never changed.

But for more complex verification (many fields, DB access is required, etc.) I describe the visitor pattern.


Comments