Last active
August 29, 2015 14:01
-
-
Save hagbarddenstore/2b982508609d6177d50b to your computer and use it in GitHub Desktop.
Example that removes the need for regions
This file contains hidden or 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
| interface IRepository<TEntity> | |
| { | |
| TEntity FindOne(Guid id); | |
| void Save(TEntity entity); | |
| } | |
| interface IUsersRepository : IRepository<User> | |
| { | |
| User FindOneByUsername(string username); | |
| } | |
| interface IGroupsRepository : IRepository<Group> | |
| { | |
| Group FindOneByName(string name); | |
| } | |
| class Database : IUsersRepository, IGroupsRepository | |
| { | |
| void IUsersRepository.FindOne(Guid id) | |
| { | |
| return FindOne<User>(id); | |
| } | |
| void IUsersRepository.Save(User entity) | |
| { | |
| Save(entity); | |
| } | |
| User IUsersRepository.FindOneByUsername(string username) | |
| { | |
| throw new NotImplementedException(); | |
| } | |
| void IGroupsRepository.FindOne(Guid id) | |
| { | |
| return FindOne<Group>(id); | |
| } | |
| void IGroupsRepository.Save(Group entity) | |
| { | |
| Save(entity); | |
| } | |
| void IGroupsRepository.FindOneByName(string name) | |
| { | |
| throw new NotImplementedException(); | |
| } | |
| private TEntity FindOne<TEntity>(Guid id) | |
| { | |
| throw new NotImplementedException(); | |
| } | |
| private void Save<TEntity>(TEntity entity) | |
| { | |
| throw new NotImplementedException(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment