Domain Model is a Magical Bag that Validates the Business
Rules
In Queries, Repositories give data back in Domain Obj, this
data is then filtered and filled in the Model, in controllers, further this
Model is augmented with View specific info and we get the ViewModel. That is
finally rendered on the View. Behavior or Domain Logic part of the Domain Model
is not involved in the fetch operations. We just treat the Hydrated Domain Obj
as the Data Bags. We do not execute the business logic inside the Domain Logic.
But in Commands, we hydrated Models from ViewModels, we
hydrate Domain Obj. from the Models. During this, we may fetch data from the
DB. When Domain Obj. are Hydrated, we executed Domain Logic against them.
Hydrated Domain Obj. รง
Request Data + Data fetched form DB
When Hydrated, now the Domain Model has become a Magical
Bag, we call method and tell whether the information given is valid or not. We
can infer information about the Data Provided. Business Rules are applied on
these Hydrated Domain Obj and we get results from it. These Results help us to
do different operations on the Data. We send email, archive data, send message
to another application, we can generated more data to be inserted.
No comments:
Post a Comment