c# - DDD: Pattern for submitting and approving contracts -
i'm working on app following requirements exist:
- a user submits data in form , gets persisted "draft copy."
- on other end, approver reads , takes action (approve, reject, etc)
- if approver approves draft copy, becomes contract , 2 parties legally bound. original submitter can go , make changes draft copy, , resubmit. when approver approves recent version, existing contract replaced new one.
what i'm struggling trying employ ddd on our project , no solution "feels right." pretty inexperienced modern ddd, finding right model quite confusing.
this not document management problem. there 1 draft copy submitter works with, , there contract neither party can edit (edits performed resubmitting draft copy changes). these purposes, fields in these 2 domain concepts identical.
is there design pattern or ddd friendly solution can applied here?
i not sure want here, suggest should @ eventsourcing pattern. useful tracking change of domain object. follow martin fowler:
event sourcing ensures changes application state stored sequence of events. not can query these events, can use event log reconstruct past states, , foundation automatically adjust state cope retroactive changes.
and greg young:
another problem having of 2 models is more work. 1 must create code save current state of objects , 1 must write code generate , publish events. no matter how go doing these things cannot possibly easier publishing events, if had made storing current state trivial document storage, there still effort of bringing project.
—greg young -
when user submit 'draft copy' should raised event , store eventsourcing
. user raise 'draft copy' captured eventsourcing
object , mark new version. how make different should apply ddd. document object domain
object , have identifier.
it easy querying , update state eventsourcing
each versions of entity, , take version of object.
you can take more reference eventsourcing
msdn.
hope help.
Comments
Post a Comment