Created
October 12, 2012 19:25
-
-
Save yreynhout/3880987 to your computer and use it in GitHub Desktop.
VideoTape - Video
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
// In its simplest form | |
public class VideoTape { | |
// as purely constructor injection of a "parent" | |
public VideoTape(Video video) { | |
_video = video; | |
} | |
} | |
public class VideoTape : IVideoObjectInheritor { | |
// as a hidden-from-the-public-eye method based injection | |
void IVideoObjectInheritor.InheritFrom(Video video) { | |
_video = video; | |
} | |
} | |
public class VideoTape { | |
// as part of an event sourced rehydration/materialization process | |
public void LoadFromHistory(Video video, IEnumerable<object> events) { | |
_video = video; | |
foreach(var @event in events) | |
Replay(@event); | |
} | |
} | |
// more approaches exist - use your imagination (or someone else's). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment