D
Daniel C
In our domain driven design, we allow clients to consume a service
that includes a "Save Step" method (public Step SaveStep(Step
userStep). This works great for the consumers of the web service
(easy call, just send back entire step object) and for persisting the
step data to the data store (just send the step to the repos).
It gets a little more complicated when we introduce the idea that
SaveStep should, in addition to persisting data, trigger a specific
event that is captured by an outside process, such as a workflow
engine. A Step in this case is somewhat complex; a collection of
users, collection of documents, and permissions per user on the
documents. We need to trigger events such as user added, removed,
permission set added/removed, etc. Is there a best practice/pattern/
example to approaching this; basically, comparing the passed in step
to the persisted step and generating what has changed?
I could obviously write a very specific algo to compare the saved and
new steps, with hard-coded references to each component in the
Step...but this would be ugly and not very adaptable to changes in the
Step in the future.
that includes a "Save Step" method (public Step SaveStep(Step
userStep). This works great for the consumers of the web service
(easy call, just send back entire step object) and for persisting the
step data to the data store (just send the step to the repos).
It gets a little more complicated when we introduce the idea that
SaveStep should, in addition to persisting data, trigger a specific
event that is captured by an outside process, such as a workflow
engine. A Step in this case is somewhat complex; a collection of
users, collection of documents, and permissions per user on the
documents. We need to trigger events such as user added, removed,
permission set added/removed, etc. Is there a best practice/pattern/
example to approaching this; basically, comparing the passed in step
to the persisted step and generating what has changed?
I could obviously write a very specific algo to compare the saved and
new steps, with hard-coded references to each component in the
Step...but this would be ugly and not very adaptable to changes in the
Step in the future.