I am developing my first DDD application and trying to follow some basic rules that I have learned in the last few months.
I implemented a repository template using Nhibernate.
I thought I could "move" my entities from the controller to the view, but I soon realized that it was almost impossible.
Most people prefer to define a viewing model for each view. I don’t particularly like the idea of overriding the fields that I have already created for my objects, but it seems that this is the only way.
Now I am faced with a situation where I want to apply some validation rules.
I thought that I could bind validation rules (with DataAnnotations) to objects, but cannot work if I use the viewmodel.
Here are the questions:
- Should validation be part of a domain model?
- Does it not take a lot of time to create a model, and then spend time reassigning the same fields (properties) to the viewmodel?
- Is it not an anemic model if it does not have at least the rules of verification? I'm starting to wonder if DDD is really suitable for small to medium sized applications.
I appreciate any help / suggestion.
source
share