Skip to content

Instantly share code, notes, and snippets.

@csainty
Created January 29, 2013 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csainty/4665451 to your computer and use it in GitHub Desktop.
Save csainty/4665451 to your computer and use it in GitHub Desktop.
public interface IQueries
{
Foo GetFoo(int fooId);
IEnumerable<Foo> QueryFooByBar(int barId);
}
public interface ICommands
{
void AddFooToBar(int barId, Foo foo);
}
public class Repository : IQueries, ICommands
{
public IQueries Queries { get { return this; } }
public ICommands Commands { get { return this; } }
Foo IQueries.GetFoo(int fooId) {
// Implementation
}
// Other interface implementations
}
// Some other code
{
var repository = new Repository();
var foo = repository.Queries.GetFoo(1);
repository.Commands.AddFooTobar(2, foo);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment