Exemple #1
0
 public AccountManager(
     IApplicationUnitOfWork unitOfWork,
     IObjectMapper objectMapper,
     IConfigurationProvider configurationProvider, ILogManager logger)
     : base(unitOfWork, objectMapper, configurationProvider, logger)
 {
 }
Exemple #2
0
 public ResetTicketManager(
     IApplicationUnitOfWork unitOfWork,
     IObjectMapper objectMapper,
     IConfigurationProvider configurationProvider, ILogManager logger)
     : base(unitOfWork, unitOfWork.ResetTickets, objectMapper, configurationProvider, logger)
 {
 }
Exemple #3
0
 public CustomerService(
     IApplicationUnitOfWork unitOfWork,
     IMapper mapper)
 {
     this._unitOfWork = unitOfWork;
     this._mapper     = mapper;
 }
 public PostController(IApplicationUnitOfWork applicationUnitOfWork, IOptions <ApplicationOptions> optionsAccessor, IMapper mapper, ILoggerFactory loggerFactory)
 {
     _applicationUnitOfWork = applicationUnitOfWork;
     _applicationOptions    = optionsAccessor.Value;
     _mapper = mapper;
     _logger = loggerFactory.CreateLogger(GetType().Namespace);
 }
Exemple #5
0
 /// <summary>
 /// 初始化应用程序服务
 /// </summary>
 /// <param name="unitOfWork">工作单元</param>
 /// <param name="repository">应用程序仓储</param>
 /// <param name="exportFactory">文件导出操作工厂</param>
 public ApplicationService(IApplicationUnitOfWork unitOfWork, IApplicationRepository repository,
                           IExportFactory exportFactory)
     : base(unitOfWork, repository)
 {
     Repository    = repository;
     ExportFactory = exportFactory;
 }
 public GetNoteQueryHandler(
     IApplicationUnitOfWork applicationUnitOfWork,
     IMapper mapper)
 {
     _applicationUnitOfWork = applicationUnitOfWork;
     _mapper = mapper;
 }
        public BaseHandlerTests()
        {
            var mapperConfiguration = new MapperConfiguration(opts => opts.AddProfile(typeof(MappingsProfile)));

            _mapper = mapperConfiguration.CreateMapper();

            _mockRepository           = new MockRepository(MockBehavior.Strict);
            _authenticatedUserService = _mockRepository.Create <IAutheticatedUserService>();
            _dateTimeService          = _mockRepository.Create <IDateTimeService>();


            _dateTimeService.Setup(x => x.GetTime()).Returns(_testDateTime);
            _authenticatedUserService.Setup(x => x.GetUserId()).Returns(_testUserId);

            var dbContextOptions = new DbContextOptionsBuilder <ApplicationDbContext>()
                                   .UseInMemoryDatabase(Guid.NewGuid().ToString())
                                   .ConfigureWarnings(x => x.Ignore(InMemoryEventId.TransactionIgnoredWarning))
                                   .Options;

            _applicationDbContext = new ApplicationDbContext(dbContextOptions, _authenticatedUserService.Object, _dateTimeService.Object);

            _invoiceRepository  = new ApplicationRepository <Invoice>(_applicationDbContext);
            _noteRepository     = new ApplicationRepository <Note>(_applicationDbContext);
            _userInfoRepository = new ApplicationRepository <UserInfo>(_applicationDbContext);

            _appUnitOfWork = new ApplicationUnitOfWork(_applicationDbContext, _userInfoRepository, _noteRepository, _invoiceRepository);
        }
Exemple #8
0
 public TimeEntryManager(
     IApplicationUnitOfWork unitOfWork,
     IObjectMapper objectMapper,
     IConfigurationProvider configurationProvider, ILogManager logger)
     : base(unitOfWork, unitOfWork.TimeEntries, objectMapper, configurationProvider, logger)
 {
 }
 protected CrudManager(
     IApplicationUnitOfWork unitOfWork,
     IRepository <TEntity> repository,
     IObjectMapper objectMapper,
     IConfigurationProvider configurationProvider, ILogManager logger)
     : base(unitOfWork, repository, objectMapper, configurationProvider, logger)
 {
 }
Exemple #10
0
 public ProjectManager(
     IApplicationUnitOfWork unitOfWork,
     IObjectMapper objectMapper,
     IConfigurationProvider configurationProvider, ILogManager logger, IManagerStore store)
     : base(unitOfWork, unitOfWork.Projects, objectMapper, configurationProvider, logger)
 {
     _store = store;
 }
 public CreateNoteCommandHandler(
     IApplicationUnitOfWork applicationUnitOfWork,
     ILogger <CreateNoteCommandHandler> logger,
     IMapper mapper)
 {
     _applicationUnitOfWork = applicationUnitOfWork;
     _logger = logger;
     _mapper = mapper;
 }
Exemple #12
0
 public UserService(UserManager <IdentityUser> userManager,
                    RoleManager <IdentityRole> roleManager,
                    IUserRepository repositorio,
                    IApplicationUnitOfWork uow)
     : base(uow)
 {
     _userManager = userManager;
     _roleManager = roleManager;
     _repository  = repositorio;
 }
 protected BaseManager(
     IApplicationUnitOfWork unitOfWork,
     IObjectMapper objectMapper,
     IConfigurationProvider configurationProvider, ILogManager logger)
 {
     UnitOfWork            = unitOfWork;
     ObjectMapper          = objectMapper;
     ConfigurationProvider = configurationProvider;
     Logger = logger;
 }
 public UpdateNoteCommandHandler(
     IApplicationUnitOfWork applicationUnitOfWork,
     ILogger <UpdateNoteCommandHandler> logger,
     IAutheticatedUserService userService
     )
 {
     _applicationUnitOfWork = applicationUnitOfWork;
     _logger      = logger;
     _userService = userService;
 }
Exemple #15
0
 public Handler(
     IMapper mapper,
     ILogger <Update> logger,
     IApplicationUnitOfWork unitOfWork,
     IPersonRepository persons)
 {
     _mapper     = mapper;
     _logger     = logger;
     _unitOfWork = unitOfWork;
     _persons    = persons;
 }
Exemple #16
0
        public RoomTypeService(IApplicationUnitOfWork unitOfWork, ILogger <BaseService> logger) : base(unitOfWork,
                                                                                                       logger)
        {
            MapperConfiguration = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <RoomType, RoomTypeViewModel>().ForMember(destination =>
                                                                        destination.RoomTypeId, ops => ops.MapFrom(source => source.Id));

                cfg.CreateMap <RoomTypeViewModel, RoomType>().ForMember(destination =>
                                                                        destination.Id, ops => ops.MapFrom(source => source.RoomTypeId));
            });
        }
 public BookService(IBookRepository bookRepositorio,
                    IBookCategoryRepository bookCategoryRepository,
                    IUserRepository userRepository,
                    IUserBookRentRepository userBookRentRepository,
                    IApplicationUnitOfWork uow)
     : base(uow)
 {
     _bookRepository         = bookRepositorio;
     _bookCategoryRepository = bookCategoryRepository;
     _userRepository         = userRepository;
     _userBookRentRepository = userBookRentRepository;
 }
        public void Initialize()
        {
            var options = new DbContextOptionsBuilder <ApplicationContext>()
                          .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString())
                          .Options;

            _applicationUnitOfWork = new ApplicationContext(options);

            _applicationUnitOfWork.SeedMockCustomers();

            _applicationUnitOfWork.Database.EnsureCreated();

            var mappingConfig = new MapperConfiguration(mc =>
            {
                mc.AddProfile(new ApplicationMappingProfile());
            });

            IMapper mapper = mappingConfig.CreateMapper();

            _customerService = new CustomerService(_applicationUnitOfWork, mapper);
        }
        public static void SeedMockCustomers(this IApplicationUnitOfWork applicationUnitOfWork)
        {
            var customers = new List <Customer>()
            {
                new Customer()
                {
                    Id = 1, UniqueIdentifier = Guid.NewGuid(), FirstName = "John", LastName = "Doe"
                },
                new Customer()
                {
                    Id = 2, UniqueIdentifier = Guid.NewGuid(), FirstName = "Johnny", LastName = "Public"
                },
                new Customer()
                {
                    Id = 3, UniqueIdentifier = Guid.NewGuid(), FirstName = "Stiven", LastName = "King"
                },
                new Customer()
                {
                    Id = 4, UniqueIdentifier = Guid.NewGuid(), FirstName = "Michael", LastName = "Jordan"
                },
                new Customer()
                {
                    Id = 5, UniqueIdentifier = Guid.NewGuid(), FirstName = "Anne", LastName = "Li"
                },
                new Customer()
                {
                    Id = 6, UniqueIdentifier = Guid.NewGuid(), FirstName = "Brian", LastName = "McAlly"
                },
                new Customer()
                {
                    Id = 7, UniqueIdentifier = Guid.NewGuid(), FirstName = "Bobby", LastName = "Chan"
                },
            };

            applicationUnitOfWork.Customers.AddRange(customers);
            applicationUnitOfWork.SaveChanges();
        }
Exemple #20
0
 public CustomerController(IApplicationUnitOfWork unitOfWork)
 {
     _unitOfWork = unitOfWork;
 }
Exemple #21
0
 /// <summary>
 /// 初始化应用程序仓储
 /// </summary>
 /// <param name="unitOfWork">安全工作单元</param>
 /// <param name="sqlQuery">Sql查询对象</param>
 public ApplicationRepository(IApplicationUnitOfWork unitOfWork, ISqlQuery sqlQuery)
     : base(unitOfWork)
 {
     _sqlQuery = sqlQuery;
 }
 public PersonRepository(IApplicationUnitOfWork unitOfWork) : base(unitOfWork)
 {
 }
 public UsersController(IApplicationUnitOfWork uow)
 {
     _uow = uow;
 }
 /// <summary>
 /// 初始化图标分类仓储
 /// </summary>
 /// <param name="unitOfWork">工作单元</param>
 public IconCategoryRepository(IApplicationUnitOfWork unitOfWork)
     : base(unitOfWork)
 {
 }
Exemple #25
0
 public CashAccountManager(IApplicationUnitOfWork unitOfWork)
     : base(unitOfWork, unitOfWork.CashAccounts)
 {
 }
 /// <summary>
 /// 初始化系统配置仓储
 /// </summary>
 /// <param name="unitOfWork">工作单元</param>
 public SystemConfigRepository(IApplicationUnitOfWork unitOfWork)
     : base(unitOfWork)
 {
 }
Exemple #27
0
 public BaseService(IApplicationUnitOfWork unitOfWork, ILogger <BaseService> logger)
 {
     Logger     = logger;
     UnitOfWork = unitOfWork;
 }
Exemple #28
0
 public BaseService(IApplicationUnitOfWork uow)
 {
     _uow = uow;
 }
Exemple #29
0
 /// <summary>
 /// 初始化地区服务
 /// </summary>
 /// <param name="unitOfWork">工作单元</param>
 /// <param name="repository">地区仓储</param>
 public AreaService(IApplicationUnitOfWork unitOfWork, IAreaRepository repository)
     : base(unitOfWork, repository)
 {
     Repository = repository;
 }
 public CategoryController(IApplicationUnitOfWork applicationUnitOfWork, IMapper mapper, ILoggerFactory loggerFactory)
 {
     _applicationUnitOfWork = applicationUnitOfWork;
     _mapper = mapper;
     _logger = loggerFactory.CreateLogger(GetType().Namespace);
 }