Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            IKernel            ninjectKernel     = new StandardKernel(new InterfacesRegistrationsBLL(Configuration.GetConnectionString("BookshelfDatabase")));
            IUnitOfWorkService unitOfWorkService = ninjectKernel.Get <IUnitOfWorkService>();

            UnitOfWorkExceptionMessageLocalization = ninjectKernel.Get <IUnitOfWorkExceptionMessageLocalization>();
            services.AddScoped <IDataBaseService <AuthorDTO> >(o => new AuthorService(unitOfWorkService, UnitOfWorkExceptionMessageLocalization));
            services.AddScoped <IDataBaseService <BookDTO> >(o => new BookService(unitOfWorkService, UnitOfWorkExceptionMessageLocalization));
            services.AddScoped <IDataBaseService <GenreDTO> >(o => new GenreService(unitOfWorkService, UnitOfWorkExceptionMessageLocalization));
            services.AddScoped <IDataBaseService <TagDTO> >(o => new TagService(unitOfWorkService, UnitOfWorkExceptionMessageLocalization));
            services.AddScoped <IReportService>(o => new ReportService(unitOfWorkService, UnitOfWorkExceptionMessageLocalization));
            services.AddScoped <IAccountService>(o => new AccountService(unitOfWorkService, UnitOfWorkExceptionMessageLocalization));
            services.AddAutoMapper();
            services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
            .AddJwtBearer(cfg =>
            {
                cfg.RequireHttpsMetadata      = false;
                cfg.SaveToken                 = true;
                cfg.TokenValidationParameters = new TokenValidationParameters()
                {
                    ValidIssuer      = "me",
                    ValidAudience    = "you",
                    IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("rlyaKithdrYVl6Z80ODU350md"))         //Secret
                };
            });
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
            BLLAutoMapperConfiguration.Configure();
            services.AddSwaggerDocumentation();
        }
        protected override ICRUDDataBaseService <DriverLicenseGetDTO, DriverLicenseAddDTO, DriverLicenseUpdateDTO> CreateService
            (IUnitOfWorkService unitOfWorkService, IMapper mapper, IStringLocalizer <SharedResource> localizer, IUnitOfWorkValidator unitOfWorkValidator)
        {
            var service = new DriverLicenseService(unitOfWorkService, mapper, unitOfWorkValidator);

            service.Localizer = localizer;
            return(service);
        }
Exemplo n.º 3
0
 public MediaImporter(ILogger logger, IMediaFileSystemHelper fsHelper, IUnitOfWorkService unitOfWorkService)
 {
     this.Logger            = logger;
     this.MediaFSHelper     = fsHelper;
     this.UnitOfWorkService = unitOfWorkService;
     this.scanner           = new MediaScanner(this.Logger, this.UnitOfWorkService, this.MediaFSHelper);
     this.monitor           = new MediaMonitor(this.Logger, this.UnitOfWorkService, this.MediaFSHelper);
 }
        protected override ICRUDDataBaseService <PositionGetUpdateDTO, PositionAddDTO, PositionGetUpdateDTO> CreateService
            (IUnitOfWorkService unitOfWorkService, IMapper mapper, IStringLocalizer <SharedResource> localizer, IUnitOfWorkValidator unitOfWorkValidator)
        {
            var service = new PositionService(unitOfWorkService, mapper, unitOfWorkValidator);

            service.Localizer = localizer;
            return(service);
        }
 public AccountService(ICommandSender <Cqrs.Authentication.ISingleSignOnToken> commandSender, IUnitOfWorkService unitOfWorkService, IQueryFactory queryFactory, IAuthenticationTokenHelper <Cqrs.Authentication.ISingleSignOnToken> authenticationTokenHelper, ICorrelationIdHelper correlationIdHelper, ILogger logger)
 {
     CommandSender             = commandSender;
     UnitOfWorkService         = unitOfWorkService;
     QueryFactory              = queryFactory;
     AuthenticationTokenHelper = authenticationTokenHelper;
     CorrelationIdHelper       = correlationIdHelper;
     Logger = logger;
 }
Exemplo n.º 6
0
 public IndexModel(
     UserManager <UserCustom> userManager,
     SignInManager <UserCustom> signInManager,
     IUnitOfWorkService unitOfWork)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _unitOfWork    = unitOfWork;
 }
Exemplo n.º 7
0
 public InventoryItemService(ICommandSender <Cqrs.Authentication.ISingleSignOnToken> commandSender, IUnitOfWorkService unitOfWorkService, IQueryFactory queryFactory, IAuthenticationTokenHelper <Cqrs.Authentication.ISingleSignOnToken> authenticationTokenHelper, ICorrolationIdHelper corrolationIdHelper, IInventoryItemRepository inventoryItemRepository)
 {
     CommandSender             = commandSender;
     UnitOfWorkService         = unitOfWorkService;
     QueryFactory              = queryFactory;
     AuthenticationTokenHelper = authenticationTokenHelper;
     CorrolationIdHelper       = corrolationIdHelper;
     InventoryItemRepository   = inventoryItemRepository;
 }
Exemplo n.º 8
0
 public MediaController(IUnitOfWorkService unitOfWorkService,
                        IMapper mapper,
                        IMediaFileSystemController fsController,
                        IThumbnailer thumbnailer)
 {
     this.UnitOfWorkService = unitOfWorkService;
     this.Mapper            = mapper;
     this.FSController      = fsController;
     this.Thumbnailer       = thumbnailer;
 }
Exemplo n.º 9
0
 public PhoneRankingService(
     IUnitOfWorkService unitOfWorkService,
     ICacheService cacheService,
     IWebScraper webScraper
     )
 {
     _cacheService      = cacheService;
     _unitOfWorkService = unitOfWorkService;
     _webScraper        = webScraper;
 }
Exemplo n.º 10
0
 public RegisterModel(
     UserManager <UserCustom> userManager,
     SignInManager <UserCustom> signInManager,
     ILogger <RegisterModel> logger,
     IUnitOfWorkService unitOfWork)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _logger        = logger;
     _unitOfWork    = unitOfWork;
 }
 public OrderService(ICommandSender <Cqrs.Authentication.ISingleSignOnToken> commandSender, IUnitOfWorkService unitOfWorkService, IQueryFactory queryFactory, IAuthenticationTokenHelper <Cqrs.Authentication.ISingleSignOnToken> authenticationTokenHelper, ICorrelationIdHelper correlationIdHelper, IOrderRepository orderRepository, ILogger logger, IEventStore <Cqrs.Authentication.ISingleSignOnToken> eventStore)
     : base(eventStore, logger, correlationIdHelper, authenticationTokenHelper)
 {
     CommandSender             = commandSender;
     UnitOfWorkService         = unitOfWorkService;
     QueryFactory              = queryFactory;
     AuthenticationTokenHelper = authenticationTokenHelper;
     CorrelationIdHelper       = correlationIdHelper;
     OrderRepository           = orderRepository;
     Logger = logger;
 }
Exemplo n.º 12
0
 /// <summary>
 /// Constructor
 /// </summary>
 internal LoadingServices(IDataSetup dataSetup, ICmObjectIdFactory objIdFactory,
                          IFwMetaDataCacheManaged mdcManaged, ILgWritingSystemFactory wsf, IUnitOfWorkService uowService,
                          ICmObjectSurrogateRepository surrRepository, ICmObjectRepository cmObjRepository)
 {
     m_dataSetup       = dataSetup;
     m_objIdFactory    = objIdFactory;
     m_mdcManaged      = mdcManaged;
     m_wsf             = wsf;
     m_uowService      = uowService;
     m_surrRepository  = surrRepository;
     m_cmObjRepository = cmObjRepository;
 }
Exemplo n.º 13
0
        public void ConfigureServices(IServiceCollection services)
        {
            var mappingConfig = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile <EmployeeToEmployeeDTOProfile>();
                cfg.AddProfile <PositionToPositionDTOProfile>();
                cfg.AddProfile <DriverCategoryToDriverCategoryDTOProfile>();
                cfg.AddProfile <DriverLicensePhotoToDriverLicensePhotoDTOProfile>();
                cfg.AddProfile <DriverLicenseToDriverLicenseDTOProfile>();
                cfg.AddProfile <DriverMedicalCertificateToDriverMedicalCertificateDTOProfile>();
                cfg.AddProfile <DriverMedicalCertificatePhotoToDriverMedicalCertificatePhotoDTOProfile>();
            });
            IMapper mapper = mappingConfig.CreateMapper();

            services.AddSingleton(mapper);

            IKernel              ninjectKernel       = new StandardKernel(new InterfacesRegistrationsBLL(Configuration.GetConnectionString("LaborProtectionDatabase")));
            IUnitOfWorkService   unitOfWorkService   = ninjectKernel.Get <IUnitOfWorkService>();
            IUnitOfWorkValidator unitOfWorkValidator = ninjectKernel.Get <IUnitOfWorkValidator>();

            services.AddScoped <ICRUDDataBaseService <EmployeeGetDTO, EmployeeAddDTO, EmployeeUpdateDTO> >(o => new EmployeeService(unitOfWorkService, mapper, unitOfWorkValidator));
            services.AddScoped <ICRUDDataBaseService <PositionGetUpdateDTO, PositionAddDTO, PositionGetUpdateDTO> >(o => new PositionService(unitOfWorkService, mapper, unitOfWorkValidator));
            services.AddScoped <ICRUDDataBaseService <DriverCategoryGetUpdateDTO, DriverCategoryAddDTO, DriverCategoryGetUpdateDTO> >(o => new DriverCategoryService(unitOfWorkService, mapper, unitOfWorkValidator));
            services.AddScoped <ICRUDDataBaseService <DriverLicenseGetDTO, DriverLicenseAddDTO, DriverLicenseUpdateDTO> >(o => new DriverLicenseService(unitOfWorkService, mapper, unitOfWorkValidator));
            services.AddScoped <ICRUDDataBaseService <DriverMedicalCertificateGetDTO, DriverMedicalCertificateAddDTO, DriverMedicalCertificateUpdateDTO> >(o => new DriverMedicalCertificateService(unitOfWorkService, mapper, unitOfWorkValidator));
            services.AddScoped <ICRUDDataBaseService <DriverLicensePhotoGetDTO, DriverLicensePhotoAddDTO, DriverLicensePhotoUpdateDTO> >(o => new DriverLicensePhotoService(unitOfWorkService, mapper, unitOfWorkValidator));
            services.AddScoped <ICRUDDataBaseService <DriverMedicalCertificatePhotoGetDTO, DriverMedicalCertificatePhotoAddDTO, DriverMedicalCertificatePhotoUpdateDTO> >(o => new DriverMedicalCertificatePhotoService(unitOfWorkService, mapper, unitOfWorkValidator));
            services.AddScoped <IUploadDataFromFileService <XLWorkbook, ReadModelForExcel> >(o => new UploadDataFromExcelService(unitOfWorkService, mapper, unitOfWorkValidator));

            services.AddLocalization(options => options.ResourcesPath = "Resources");
            services.AddMvc()
            .AddDataAnnotationsLocalization(options =>
            {
                options.DataAnnotationLocalizerProvider = (type, factory) =>
                                                          factory.Create(typeof(SharedResource));
            })
            .AddViewLocalization()
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
            services.Configure <RequestLocalizationOptions>(options =>
            {
                var supportedCultures = new[]
                {
                    new CultureInfo("en"),
                    new CultureInfo("ru")
                };
                options.DefaultRequestCulture = new RequestCulture("en");
                options.SupportedCultures     = supportedCultures;
                options.SupportedUICultures   = supportedCultures;
            });
            services.AddSwaggerDocumentation();
        }
Exemplo n.º 14
0
        public TripController(IRepositoryTrip tripRepository,
                              IRepositoryHistoryTrip historyRepository,

                              ITripService tripService,
                              IUtilService utilService,
                              IUserService userService,
                              IUnitOfWorkService unitOfWorkService,

                              IWebHostEnvironment webHostEnvironment)
        {
            _repositoryTrip        = tripRepository;
            _repositoryHistoryTrip = historyRepository;

            _tripService       = tripService;
            _utilService       = utilService;
            _userService       = userService;
            _unitOfWorkService = unitOfWorkService;

            _webHostEnvironment = webHostEnvironment;
        }
Exemplo n.º 15
0
 public ContatoService(UnitOfWorkService uow)
     : base(uow)
 {
     _uow = uow;
 }
 public EmployeeService(IUnitOfWorkService uow)
 {
     _uow = uow;
 }
Exemplo n.º 17
0
 public CreateAlbumsJob(ILogger logger, IUnitOfWorkService unitOfWorkService,
                        IMediaFileSystemController fsController) : base(logger)
 {
     this.FSController      = fsController;
     this.UnitOfWorkService = unitOfWorkService;
 }
Exemplo n.º 18
0
 public VerifyMediaJob(ILogger logger, IUnitOfWorkService unitOfWorkService, IMediaFileSystemHelper helper)
     : base(logger)
 {
     this.UnitOfWorkService = unitOfWorkService;
     this.MediaFSHelper     = helper;
 }
Exemplo n.º 19
0
		/// <summary>
		///
		/// </summary>
		public override void FixtureSetup()
		{
			base.FixtureSetup();

			m_wordFormFactory = Cache.ServiceLocator.GetInstance<IWfiWordformFactory>();

			var servLoc = Cache.ServiceLocator;
			NonUndoableUnitOfWorkHelper.Do(m_actionHandler, () =>
				{
					Cache.LanguageProject.PeopleOA = servLoc.GetInstance<ICmPossibilityListFactory>().Create();
					Cache.LanguageProject.PeopleOA.PossibilitiesOS.Add(servLoc.GetInstance<ICmPersonFactory>().Create());
					// force Scripture reference system to be created - along with TranslatedScriptureOA
					Cache.LangProject.TranslatedScriptureOA = servLoc.GetInstance<IScriptureFactory>().Create();
				});
			m_uowService = Cache.ServiceLocator.GetInstance<IUnitOfWorkService>();
		}
Exemplo n.º 20
0
		void VerifyChanges(ICmObject[] expectedNewbies, ICmObject[] expectedDirtballs,
			ICmObjectId[] expectedGoners, IUnitOfWorkService m_uowService)
		{
			var newbies = new HashSet<ICmObjectId>();
			var dirtballs = new HashSet<ICmObjectOrSurrogate>(new ObjectSurrogateEquater());
			var goners = new HashSet<ICmObjectId>();
			m_uowService.GatherChanges(newbies, dirtballs, goners);
			var setNewbies = new HashSet<ICmObjectId>(from obj in expectedNewbies select obj.Id);
			Assert.That(newbies.Except(setNewbies), Is.Empty, "some unexpected newbies were found");
			Assert.That(setNewbies.Except(newbies), Is.Empty, "some expected newbies were not found");
			var setDirtballs = new HashSet<ICmObjectOrSurrogate>(expectedDirtballs.Cast<ICmObjectOrSurrogate>());
			Assert.That(dirtballs.Except(setDirtballs), Is.Empty, "some unexpected dirtballs were found");
			Assert.That(setDirtballs.Except(dirtballs), Is.Empty, "some expected dirtballs were not found");
			var setGoners = new HashSet<ICmObjectId>(expectedGoners);
			Assert.That(goners.Except(setGoners), Is.Empty, "some unexpected goners were found");
			Assert.That(setGoners.Except(goners), Is.Empty, "some expected goners were not found");
		}
Exemplo n.º 21
0
		internal override void RegisterVirtualsModifiedForObjectDeletion(IUnitOfWorkService uow)
		{
			var cache = Cache; // need to make the Func use this local variable, because on Redo, Cache may return null.
			uow.RegisterVirtualCollectionAsModified(Cache.LangProject,
				Cache.ServiceLocator.GetInstance<Virtuals>().LangProjectAllWordforms,
				() => cache.ServiceLocator.GetInstance<IWfiWordformRepository>().AllInstances(),
				new IWfiWordform[0], new[] { this });
			base.RegisterVirtualsModifiedForObjectDeletion(uow);
		}
Exemplo n.º 22
0
 public BookingsController(IUnitOfWorkService repo)
     : base(repo)
 {
 }
Exemplo n.º 23
0
 public UploadDataFromExcelService(IUnitOfWorkService unitOfWorkService, IMapper mapper, IUnitOfWorkValidator unitOfWorkValidator) :
     base(unitOfWorkService, mapper)
 {
     validator           = unitOfWorkValidator.ValidatorExcelFile;
     validator.Localizer = Localizer;
 }
Exemplo n.º 24
0
 public ServiceBase(IUnitOfWorkService uow)
 {
     _uow = uow;
 }
Exemplo n.º 25
0
 public Time_zonesController(IUnitOfWorkService repo)
     : base(repo)
 {
 }
Exemplo n.º 26
0
 public UsersController(IUnitOfWorkService repo)
     : base(repo)
 {
 }
Exemplo n.º 27
0
		/// <summary>
		/// This registers LangProjTexts for undo/redo propchanges during creation
		/// so InterestingTexts.PropChanged gets called to add the text to the record list.
		/// </summary>
		/// <param name="uow"></param>
		internal override void RegisterVirtualsModifiedForObjectCreation(IUnitOfWorkService uow)
		{
			base.RegisterVirtualsModifiedForObjectCreation(uow);
			var cache = Cache; // need to make the Func use this local variable, because on Undo, Cache may return null.
			uow.RegisterVirtualCollectionAsModified(Cache.LangProject,
				Cache.ServiceLocator.GetInstance<Virtuals>().LangProjTexts,
				() => cache.ServiceLocator.GetInstance<ITextRepository>().AllInstances(),
				new[] { this }, new IText[0]);
		}
Exemplo n.º 28
0
		/// <summary>
		/// Constructor
		/// </summary>
		internal LoadingServices(IDataSetup dataSetup, ICmObjectIdFactory objIdFactory,
			IFwMetaDataCacheManaged mdcManaged, ILgWritingSystemFactory wsf, ITsStrFactory tsf,
			IUnitOfWorkService uowService,
			ICmObjectSurrogateRepository surrRepository, ICmObjectRepository cmObjRepository)
		{
			m_dataSetup = dataSetup;
			m_objIdFactory = objIdFactory;
			m_mdcManaged = mdcManaged;
			m_wsf = wsf;
			m_tsf = tsf;
			m_uowService = uowService;
			m_surrRepository = surrRepository;
			m_cmObjRepository = cmObjRepository;
		}
Exemplo n.º 29
0
 public UnitOfWorkApp(IUnitOfWorkService db)
 {
     _db = db;
 }
Exemplo n.º 30
0
 public CreateNewMediaJob(ILogger logger, IUnitOfWorkService unitOfWorkService,
                          IMediaFileSystemHelper fsHelper) : base(logger)
 {
     this.UnitOfWorkService = unitOfWorkService;
     this.MediaFSHelper     = fsHelper;
 }
Exemplo n.º 31
0
 public StockService(IUnitOfWorkService uow) : base(uow)
 {
     _uow = uow;
 }
Exemplo n.º 32
0
 public AppServiceBase(IUnitOfWorkService uow)
 {
     _uow         = uow;
     _serviceBase = _uow.Service <IDataServiceBase <TEntity> >();
 }
Exemplo n.º 33
0
 public CategoryService(IUnitOfWorkService unitOfWorkService)
 {
     _unitOfWorkService = unitOfWorkService;
 }
Exemplo n.º 34
0
 public GenreService(IUnitOfWorkService unitOfWorkService, IUnitOfWorkExceptionMessageLocalization unitOfWorkExceptionMessageLocalization)
 {
     UnitOfWork = unitOfWorkService.GetIUnitOfWorkBookshelfContext();
     UnitOfWorkExceptionMessage = unitOfWorkExceptionMessageLocalization;
 }
Exemplo n.º 35
0
 public ValuesController(IUnitOfWorkService repo)
     : base(repo)
 {
 }
Exemplo n.º 36
0
 public StudentsController(IUnitOfWorkService unitOfWorkService, LoggerService loggerService)
 {
     _unitOfWorkService = unitOfWorkService;
     _loggerService     = loggerService;
 }