本文整理汇总了C#中IUnitOfWork.GetRepository方法的典型用法代码示例。如果您正苦于以下问题:C# IUnitOfWork.GetRepository方法的具体用法?C# IUnitOfWork.GetRepository怎么用?C# IUnitOfWork.GetRepository使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUnitOfWork
的用法示例。
在下文中一共展示了IUnitOfWork.GetRepository方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UserService
public UserService(IUnitOfWork uow)
{
this.uow = uow;
this.userRepo = uow.GetRepository<DalUser>();
this.userSkillRepo = uow.GetRepository<DalUserSkill>();
this.filterRepo = uow.GetRepository<DalFilter>();
}
示例2: ArticleService
public ArticleService(IUnitOfWork unitOfWork)
{
if (unitOfWork == null) throw new ArgumentNullException("unitOfWork");
_unitOfWork = unitOfWork;
_articleRepository = _unitOfWork.GetRepository<DalArticleEntity>();
_tagRepository = _unitOfWork.GetRepository<DalTagEntity>();
}
示例3: CommentService
public CommentService(IUnitOfWork unitOfWork)
{
if (unitOfWork == null) throw new ArgumentNullException("unitOfWork");
_unitOfWork = unitOfWork;
_commentRepository = _unitOfWork.GetRepository<DalCommentEntity>();
_articleRepository = _unitOfWork.GetRepository<DalArticleEntity>();
_userRepository = _unitOfWork.GetRepository<DalUserEntity>();
}
示例4: AjustPriceService
public AjustPriceService(IUnitOfWork UnitOfWork)
{
unitofwork = UnitOfWork;
headeRepo = unitofwork.GetRepository<ajustpriceheadeDto>();
detailRepo = unitofwork.GetRepository<ajustpricedetailDto>();
}
示例5: CoursesServiceProvider
public CoursesServiceProvider(IUnitOfWork uow)
{
_uow = uow;
_courseInstances = _uow.GetRepository<CourseInstance>();
_courseTemplates = _uow.GetRepository<CourseTemplate>();
_teacherRegistrations = _uow.GetRepository<TeacherRegistration>();
_persons = _uow.GetRepository<Person>();
}
示例6: BankCardController
public BankCardController()
{
unitOfWork = new InMemoryUnitOfWork(MvcApplication.DataStore);
var accountRepository = unitOfWork.GetRepository<Account>();
var clientModule = new ClientModule(unitOfWork.GetRepository<Client>());
var transactionModule = new TransactionModule(unitOfWork.GetRepository<Transaction>());
bankCardModule = new BankCardModule(unitOfWork.GetRepository<BankCard>());
accountModule = new AccountModule(accountRepository, bankCardModule, transactionModule, clientModule);
}
示例7: UserService
public UserService(IUnitOfWork unitOfWork)
{
_userRepository = unitOfWork.GetRepository<IUserRepository>();
_userRepository.OnAdd += UserRepositoryOnOnAdd;
_reportRepository = unitOfWork.Get<ReportModel>();
_userReportRepository = unitOfWork.Get<UserReport>();
_keyRepository = unitOfWork.Get<HashKey>();
_employeeRepository = unitOfWork.GetRepository<IEmployeeRepository>();
_unitOfWork = unitOfWork;
}
示例8: FinanceControllerTests
public FinanceControllerTests()
{
_unitOfWork = new UnitOfWorkMock();
_controller = new FinanceController(_unitOfWork);
_currentUser = new User {UserName = "currentuser"};
_currentUserProfile = new UserProfile {User = _currentUser};
_unitOfWork.GetRepository<User>().Insert(_currentUser);
_unitOfWork.GetRepository<UserProfile>().Insert(_currentUserProfile);
_unitOfWork.Save();
_controller.ControllerContext = CreateControllerContext(_currentUser);
}
示例9: AuthenticationService
public AuthenticationService(IUnitOfWork unitOfWork, ILogger logger)
: base(logger)
{
this.unitOfWork = unitOfWork;
this.logger = logger;
userRepository = unitOfWork.GetRepository<User>();
}
示例10: WorkflowUserService
public WorkflowUserService(
IUnitOfWork unitOfWork)
{
if (_manager == null)
{
var repository = unitOfWork.GetRepository<User>();
var user = repository.Find(x => x.Login == "WorkflowManager");
if (user == null)
{
user = new User
{
Login = "WorkflowManager",
CategoryID = 1,
Roles = new List<Role> {
new Role {
ChildRoles = new List<ChildRole>(),
Permissions = new List<Permission>(),
Name = "WorkflowManagerRole",
SystemRole = SystemRole.Admin
}
},
FirstName = "Менеджер бизнес-процессов"
};
repository.Create(user);
unitOfWork.SaveChanges();
}
_manager = new SecurityUser(user);
}
}
示例11: OrderService
public OrderService(IUnitOfWork unitOfWork, IInventoryRepository inventoryRepository)
{
_unitOfWork = unitOfWork;
_inventoryRepository = inventoryRepository;
_orderRepository = unitOfWork.Get<Order>();
_userRepository = unitOfWork.GetRepository<IUserRepository>();
}
示例12: GeographicRouteLocator
public GeographicRouteLocator(IGeocodeService geocodeService, IUnitOfWork unitOfWork)
{
if (geocodeService == null) throw new ArgumentNullException("geocodeService");
if (unitOfWork == null) throw new ArgumentNullException("unitOfWork");
_geocodeService = geocodeService;
_routeRepository = unitOfWork.GetRepository<Route>();
}
示例13: ReportService
public ReportService(IReportExecuter reportExecuter, IUnitOfWork unitOfWork)
{
_reportExecuter = reportExecuter;
_unitOfWork = unitOfWork;
_reportRepository = unitOfWork.Get<ReportModel>();
_userReportRepository = unitOfWork.Get<UserReport>();
_userRepository = unitOfWork.GetRepository<IUserRepository>();
}
示例14: NoteService
/// <summary>
/// Constructs a Note Service that will use the specified
/// <see cref = "IUnitOfWork"></see>
/// to retrieve data
/// </summary>
/// <param name = "unitOfWork">The <see cref = "IUnitOfWork"></see>
/// to use to retrieve data</param>
public NoteService(IUnitOfWork unitOfWork)
{
//Contract
Requires.NotNull(unitOfWork);
_unitOfWork = unitOfWork;
_repository = _unitOfWork.GetRepository<Note>();
}
示例15: TokenService
public TokenService(IHashProvider hashProvider, IUnitOfWork unitOfWork)
{
_hashProvider = hashProvider;
_tokenRespository = unitOfWork.GetRepository<ITokenRepository>();
_tokenRespository.OnAdd += (sender, args) => unitOfWork.Commit();
_tokenRespository.OnDelete += (sender, args) => unitOfWork.Commit();
}