Esempio n. 1
0
        /// <summary>
        ///     Configure
        /// </summary>
        /// <param name="app"></param>
        /// <param name="provider"></param>
        /// <param name="db"></param>
        public void Configure(IApplicationBuilder app, IApiVersionDescriptionProvider provider,
                              FitnessDatabase db)
        {
            Log.Information($"Using Exception middleware");
            app.UseExceptionMiddleware();
            Log.Information($"Using HttpsRedirection");
            app.UseHttpsRedirection();
            Log.Information($"Using Authentication");
            app.UseAuthentication();
            Log.Information($"Using Routing");
            app.UseRouting();
            Log.Information($"Using Auhtorization");
            app.UseAuthorization();
            Log.Information($"Using Endpoint");
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapHealthChecks("/healthcheck", new HealthCheckOptions
                {
                    Predicate      = _ => true,
                    ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
                });
                endpoints.MapHealthChecksUI();
            });
            Log.Information($"Using Swashbuckle");
            app.UseSwashbuckle(provider);

            Log.Information($"Using Migration of DB");
            db.Database.Migrate();
        }
Esempio n. 2
0
 public Repository(FitnessDatabase dbContext)
 {
     _dbContext = dbContext;
     _entities  = dbContext.Set <T>();
 }