Created
January 29, 2013 16:16
-
-
Save csainty/4665451 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 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