Created
August 16, 2013 10:13
-
-
Save yreynhout/6248727 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ChildRepository { | |
public Optional<Child> GetOptional(string identifier) { | |
//Very simple parent-child example | |
var childStream =_streamReader.Read(identifier); | |
var parentId = ((SomeInitialEvent)stream.Events[0]).ParentId; | |
var parentStream = _streamReader.Read(parentId); | |
var root = new Child(); | |
root.Initialize(parentStream.Events); | |
root.Initialize(childStream.Events); | |
return new Optional<Child>(root); | |
//there's no limit to how one can weave together various streams | |
//and use that union to build up the state of a particular aggregate | |
//not only can one vary along the 'multiple classes per stream' axis | |
//but also along the 'multiple streams per class' axis | |
} | |
} |
This is great, if you don't mind some of the infrastructure, leaking into the domain layer ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
KISS! I like it!