Beispiel #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, FTActivityDbContext ftactivityDbContext)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            ftactivityDbContext.EnsureSeedDataForFTActivityDbContext();

            app.UseCors("AllowAllOrigins");

            var counter = Metrics.CreateCounter("PathCounter", "Counts requests to endpoints", new CounterConfiguration
            {
                LabelNames = new[] { "method", "endpoint" }
            });

            app.Use((context, next) =>
            {
                counter.WithLabels(context.Request.Method, context.Request.Path).Inc();
                return(next());
            });
            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "FTActivity API V1");
            });

            app.UseStatusCodePages();
            app.UseMetricServer();

            AutoMapper.Mapper.Initialize(cfg =>
            {
                cfg.CreateMap <Activity, ActivityDTO>();
                cfg.CreateMap <ActivityCreationDTO, Activity>();
            });
            app.UseMvc();
        }
 public ActivityRepository(FTActivityDbContext repositoryContext) : base(repositoryContext)
 {
 }