c# - asp net mvc validation and ViewModel -
i have 4 layer solution medium size project:
- model (ef poco entities)
- data (ef objectcontext)
- services
asp net mvc question
a)should have validation attributes- dataanotation in models or mvc project?
b)where should set viewmodel-s if in mvc fill viewmodels data, in controller? else if on other project should create repository vewmodel?
c) should viewmodel have validation>?
a, c) if have view models different dtos, might prefer use dataannotations in both types. way, can validate before try persist , again persist in case dtos used outside scope of mvc app.
b) tuck view models models folder of mvc app , dtos data project separate mvc app. use automapper lot copy values between view models , dtos.
Comments
Post a Comment