EF in Version Control System #867
Replies: 3 comments
-
If what you are trying to do is a SCM, why not simply use a SCM like git to store your data? You you could use something like libgit2sharp I guess, I haven't done it myself. |
Beta Was this translation helpful? Give feedback.
-
I looked at source control initially, but my data is highly structured /complex domain model The SCM software looks like it’s document based : using (var repo = new Repository("path/to/your/repo"))
{
// Stage the file
repo.Index.Add("file/with/changes.txt");
repo.Index.Write();
} Regarding the steps I listed - do you think it’s workable or a dead end? |
Beta Was this translation helpful? Give feedback.
-
adding to my previous ...I found this paper "Maintaining Parallel Realities in CQRS and Event Sourcing" which talks about a command sourcing approach for branching AggregateRoots (its events), then changing (list of commands), and finally merging (execute changes or apply new events on base AR).
Also, Fowler talks about it "Parallel Model - Allow an alternative representation of the state of an application, either at a different time or in a hypothetical state" |
Beta Was this translation helpful? Give feedback.
-
I’m building a kind of version control system using concepts such as baseline, fork/ branch, rebase, merge, etc for a legal system
But not sure what is the best way to use EventFlow for this. I’ve got some elements of the following process working in EF but feel like I’m hacking the system which usually never ends well....
a “Base” AggregateRoot and Read Models which does not need public commands. All changes made thru Branch
a “Branch” AR and ReadModel (inherits from Base?) has additional properties like Base SequenceNumber (is Base’s version), BaseId, reason for change, and a List/collection of Commands or “Changes” to be implemented on Base)
User A creates Branch from Base (via command) which gets the current version of Base and streams all Base’s events up to that point (version/sequence#) to the Branch’s ReadModel. So now the user is looking at the current state of Base
User A executes several commands “changes” on Branch AR which emit events which are streamed to the Branch’s ReadModel but events not persisted to the event store (or alt just stored in memory since they may need to be deleted if commands change). Command added to Command/Changes List which is editable...
Note Commands in the Command /Changes List can be re-ordered, deleted, inserted, changed or the Branch can be rebased (ie new version/sequence number) and this will purge+ rebuild the read model (this is why don’t want to save events in an immutable ES) following same recess as step 3 + Commands (or their events) already in changes list (see next point about rehydrating)
Since Branch AR does not store events the state is rehydrated from Base’s Events (up to version) plus events from changes list (commands can be re-executed or we can store events and reapply them (but not in the event store) can be stored with the command).
Finally when User A is happy (actually there is a workflow approval step) the commands or their generated events can be applied to the Base and Branch retired (thinking this can be scheduled as a job)
am I on the right track?
Beta Was this translation helpful? Give feedback.
All reactions