I’m trying to determine where to place my “Validation Models”.
My structure is at the moment:
Web (have reference to Business and Objects)
-
Controllers
-
Views
-
CSS
-
Scripts
Business (have reference to Data and Objects)
- Services
Data (have reference to Objects)
- Repositories and EF Context(Code First)
Objects
- POCOs (for EF)
Now is my question where to place validation things like a LogIn Model? Should the model be placed in my Web layer or Objects layer? – or should I even store validation models like that?
Thanks in advance!
Models should be placed in your business layer. View models should be placed in your web layer because they are tied to a view. You should have a mapping between your models and view models (to facilitate this task you may use a tool like AutoMapper). Views receive view models from controllers. Validation is performed on those view models.
So:
Web