Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace MyNamespace
- {
- public class MyDbService : IMyDbService
- {
- IDbRepository<DbItem> _repository;
- readonly Type _repositoryType;
- public MyDbService()
- {
- _repositoryType = typeof(new DbRepository<DbItem>());
- }
- public MyDbService(IDbRepository<DbItem> repository)
- {
- _repository = typeof(repository);
- }
- public DbItem SomeFunction()
- {
- using (_repository = instantiateRepo())
- {
- // some actions on _repository returning DbItem
- }
- }
- IDbRepository instantiateRepo()
- {
- // returns IDbRepository concrete instance using _repositoryType
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement