Skip to content

Instantly share code, notes, and snippets.

@yreynhout
Created October 12, 2012 19:25
Show Gist options
  • Save yreynhout/3880987 to your computer and use it in GitHub Desktop.
Save yreynhout/3880987 to your computer and use it in GitHub Desktop.
VideoTape - Video
// 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