Skip to content

Instantly share code, notes, and snippets.

@mookid8000
Last active December 14, 2015 05:39
Show Gist options
  • Save mookid8000/5036740 to your computer and use it in GitHub Desktop.
Save mookid8000/5036740 to your computer and use it in GitHub Desktop.
statically injectable aggregate root loader
public interface ILoadAggregateRoots
{
T Load<T>(string id) where T:Doc;
}
public static class Loader
{
static ILoadAggregateRoots currentLoader = new ThrowMustProvideLoaderException();
public static ILoadAggregateRoots Current
{
get { return currentLoader; }
set {
if (value == null) {
throw new ArgumentNullException("must provide loader");
}
currentLoader = value;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment