Ejemplo n.º 1
0
        public void InstallServices(IServiceCollection services, IConfiguration configuration, IWebHostEnvironment env,
                                    ILogger logger)
        {
            services.AddSingleton <IGeocoderService, GoogleGeocoderService>(x =>
                                                                            new GoogleGeocoderService(configuration["GoogleGeocoderServiceApiKey"]));

            services.AddScoped <IAuthenticationService, AuthenticationService>();
            services.AddScoped <IEmployeesService, EmployeeService>();
            services.AddScoped <IUserDataService, UserDataService>();
            services.AddScoped <IProductsService, ProductsService>();
            //documents services
            services.AddScoped <IQuotationService, QuotationsService>();
            services.AddScoped <IInvoiceService, InvoicesService>();
            services.AddScoped <IOrderService, OrderService>();
            services.AddScoped <ICreditNotesService, CreditNotesService>();
            services.AddScoped <IDeliveryNotesService, DeliveryNotesService>();
            services.AddScoped <IDownPaymentRequestsService, DownPaymentRequestsService>();
            services.AddScoped <IUserLocationService, UserLocationService>();
            services.AddScoped <IEmployeeTimeClockService, EmployeeTimeClockService>();
            services.AddScoped <IActivityService, ActivityService>();
            var fileServiceSettings = new FileServiceSettings();

            configuration.Bind(nameof(FileServiceSettings), fileServiceSettings);
            services.AddSingleton(fileServiceSettings);
            services.AddScoped <IFileService, FileService>();
            services.AddScoped <IAttachmentsService, AttachmentsService>();
            services.AddScoped <IBusinessPartnerService, BusinessPartnerService>();


            services.AddTransient <MockDbAllocatorStartup>();


            typeof(IActionService).Assembly.ExportedTypes
            //.Where(x =>x.BaseType != null &&   x.GetInterfaces().Any(i=>i.IsGenericType && typeof(IActionService<>).IsAssignableFrom(i.GetGenericTypeDefinition())) && !x.IsInterface && !x.IsAbstract)
            .Where(x => typeof(IActionService).IsAssignableFrom(x) && !x.IsInterface && !x.IsAbstract)
            .ToList().ForEach(x => services.AddScoped(x));

            //   services.AddScoped<ILeadUserDataService, LeadUserDataService>();
        }
Ejemplo n.º 2
0
 public FileService(ILogger <FileService> logger, IOptions <FileServiceSettings> settings)
 {
     _logger = logger;
     _fileServiceSettings = settings.Value;
 }