public StoredFileService(IStoredFileRepository <StoredFileModelBussines <int>, int> storedFileRepository,
                          IStoredFolderRepository <StoredFolderModelBussines <int>, int> storedFolderRepository,
                          IAccountSubscriptionRepository <AccountSubscriptionModelBussines <int>, int> accountSubscriptionRepository,
                          IRootFolderRepository <RootFolderModelBussines <int>, int> rootFolderRepository,
                          ISubscriptionCapacityService subscriptionCapacityService,
                          HostingEnvironmentHelper hostingEnvironmentHelper,
                          ThumbnailHelper thumbnailHelper
                          )
 {
     this._storedFileRepository          = storedFileRepository;
     this._storedFolderRepository        = storedFolderRepository;
     this._accountSubscriptionRepository = accountSubscriptionRepository;
     this._rootFolderRepository          = rootFolderRepository;
     this._hostingEnvironmentHelper      = hostingEnvironmentHelper;
     this._thumbnailHelper             = thumbnailHelper;
     this._subscriptionCapacityService = subscriptionCapacityService;
 }
Esempio n. 2
0
        private static Serilog.ILogger GetSerilogLogger(IConfiguration configuration, ApplicationSettings config)
        {
            var logger = new LoggerConfiguration()
                         .Enrich.WithProperty("ApplicationContext", _appName)                                 //define the context in logged data
                         .Enrich.WithProperty("ApplicationEnvironment", HostingEnvironmentHelper.Environment) //define the environment
                         .Enrich.FromLogContext()                                                             //allows to use specific context if nessesary
                         .ReadFrom.Configuration(configuration);

            if (HostingEnvironmentHelper.IsDevelopmentLocalhost())
            {
                // write to file for development purposes
                logger.WriteTo.File(
                    path: Path.Combine("./serilog-logs/local-logs.txt"),
                    fileSizeLimitBytes: 100 * 1024 * 1024, // 100mb
                    restrictedToMinimumLevel: LogEventLevel.Warning
                    );
            }

            return(logger.CreateLogger());
        }
Esempio n. 3
0
        public void Configure(IApplicationBuilder app)
        {
            if (HostingEnvironmentHelper.IsDevelopmentAny())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // app.UseHsts();
            }

            app.UseHttpsRedirection();

            if (System.Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") != "Testing")
            {
                app.UseCors("default");
            }

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseSwagger();

            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "CarHealth.Api V1");
            });

            app.UseEndpoints(routes =>
            {
                routes.MapControllerRoute(
                    name: "default",
                    pattern: "/swagger/v1/swagger.json");
            });
        }
 public RootFolderService(IRootFolderRepository <RootFolderModelBussines <int>, int> rootFolderRepository,
                          HostingEnvironmentHelper hostingEnvironmentHelper)
 {
     this._rootFolderRepository     = rootFolderRepository;
     this._hostingEnvironmentHelper = hostingEnvironmentHelper;
 }