Esempio n. 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, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            app.UseApplicationInsightsRequestTelemetry();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Main/Error");
            }

            app.UseApplicationInsightsExceptionTelemetry();

            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Main}/{action=index}/{id?}"
                    );
            });

            app.Run(async(context) =>
            {
                await context.Response.WriteAsync("Hello World!");
            });
        }
Esempio n. 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure
            (Microsoft.AspNetCore.Builder.IApplicationBuilder app,
            Microsoft.AspNetCore.Hosting.IHostingEnvironment env,
            Microsoft.Extensions.Logging.ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug(minLevel: LogLevel.Trace);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            // **************************************************
            // Note:
            // نکته مهم آن است که محل نوشتن دستور ذیل بسیار
            // اهمیت دارد، اگر بعد از دستور بعدی نوشته شود، عمل نمی‌کند
            // Note: For all Actions of Controllers
            app.UseCors("AllowSpecificOrigin");
            // **************************************************

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{culture=fa-IR}/{controller=Home}/{action=Index}/{id?}");
            });
        }
Esempio n. 3
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory)
        {
            loggerFactory.AddLog4Net("log4net.config", true);


            // global cors policy
            app.UseCors(x => x
                        .AllowAnyOrigin()
                        .AllowAnyMethod()
                        .AllowAnyHeader());

            app.UseSwagger();

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

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Esempio n. 4
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory)
        {
            app.UseUnhandledExceptionCatching();
            app.UseMvc();

            loggerFactory.AddSerilog();
        }
Esempio n. 5
0
        //private SmtpClient smtp;
        //private readonly IHttpContextAccessor _httpContextAccessor;
        //private readonly IEmailSender _emailSender;
        //private readonly ISmsSender _smsSender;

        public ParametarController(
            ILoggerFactory loggerFactory,
            ISession session)
        {
            _logger = loggerFactory.CreateLogger<Parametar>();
            _session = session;
        }
Esempio n. 6
0
        public void Ok()
        {
            ImmunizationViewResponse expectedViewResponse = new ImmunizationViewResponse()
            {
                Id                 = Guid.NewGuid(),
                SourceSystemId     = "mockSourceSystemId",
                Name               = "mockName",
                OccurrenceDateTime = DateTime.ParseExact("2020/09/10 17:16:10.809", "yyyy/MM/dd HH:mm:ss.fff", CultureInfo.InvariantCulture)
            };

            PHSAResult <ImmunizationResponse> phsaResponse = new PHSAResult <ImmunizationResponse>()
            {
                Result = new ImmunizationResponse()
                {
                    ImmunizationViews = new List <ImmunizationViewResponse>()
                    {
                        expectedViewResponse
                    }
                }
            };

            string json = JsonSerializer.Serialize(phsaResponse, null);

            using Microsoft.Extensions.Logging.ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddConsole());
            IHttpClientService httpClientService = GetHttpClientService(HttpStatusCode.OK, json);

            IImmunizationDelegate immsDelegate = new RestImmunizationDelegate(loggerFactory.CreateLogger <RestImmunizationDelegate>(), httpClientService, this.configuration);
            var actualResult = immsDelegate.GetImmunizations("token", 0).Result;

            Assert.Equal(Common.Constants.ResultType.Success, actualResult.ResultStatus);
            Assert.NotNull(actualResult.ResourcePayload);
            Assert.Equal(1, actualResult.ResourcePayload.Result.ImmunizationViews.Count());
        }
Esempio n. 7
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
        {
            //loggerFactory.AddLog4Net(); //Adding log4net
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else    //Production Server
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            //app.UseSession();   //For token in session


            app.UseRouting();

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

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=AuditPortal}/{action=Login}/{id?}");
            });
        }
Esempio n. 8
0
        public void Configure(IApplicationBuilder app, IHostEnvironment env, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory)
        {
            var localizationOptions = app.ApplicationServices.GetService <IOptions <RequestLocalizationOptions> >();

            app.UseRequestLocalization(localizationOptions.Value);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }
            loggerFactory.AddFile("Log/SchoolRegister-{Date}.txt");
            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();
            app.UseSession();

            app.UseRouting();

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

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
                endpoints.MapRazorPages();
                endpoints.MapHub <ChatHub>("/chathub");
            });
        }
Esempio n. 9
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();
            loggerFactory.AddNLog();//添加NLog
            Mapper.Initialize(x => x.CreateMap <PageData <TGuide>, PageData <GuideDto> >());
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseAuthentication();
            app.UseMvc();

            #region swagger ui
            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "我的API V1");
            });
            #endregion
        }
        public void Exception()
        {
            var handlerMock = new Mock <HttpMessageHandler>();

            handlerMock
            .Protected()
            .Setup <Task <HttpResponseMessage> >(
                "SendAsync",
                ItExpr.IsAny <HttpRequestMessage>(),
                ItExpr.IsAny <CancellationToken>()
                )
            .Throws <HttpRequestException>()
            .Verifiable();

            int pageIndex = 0;
            Mock <IHttpClientService> mockHttpClientService = new Mock <IHttpClientService>();

            mockHttpClientService.Setup(s => s.CreateDefaultHttpClient()).Returns(() => new HttpClient(handlerMock.Object));

            using Microsoft.Extensions.Logging.ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddConsole());
            IHttpClientService    httpClientService = GetHttpClientService(HttpStatusCode.RequestTimeout, string.Empty);
            IImmunizationDelegate immsDelegate      = new RestImmunizationDelegate(loggerFactory.CreateLogger <RestImmunizationDelegate>(), mockHttpClientService.Object, this.configuration);
            var actualResult = immsDelegate.GetImmunizations("token", pageIndex).Result;

            Assert.True(actualResult.ResultStatus == Common.Constants.ResultType.Error && actualResult.ResultError.ErrorCode == "testhostServer-CE-PHSA");
        }
Esempio n. 11
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, CygateWMSContext context)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            if (env.IsProduction() || env.IsStaging() || env.IsEnvironment("Staging_2"))
            {
                app.UseExceptionHandler("/Error");
                app.UseHsts();
            }


            //app.UseExceptionHandler("/Home/Error");
            app.UseAuthentication();
            app.UseStaticFiles();
            app.UseCookiePolicy();
            app.UseSession();
            //app.UseStatusCodePagesWithRedirects("/Home/Error");
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Account}/{action=Login}/{id?}");
            });
            DbInitializer.Initialize(context);
        }
Esempio n. 12
0
 public TemplateController(NHibernate.ISession session, ILoggerFactory loggerFactory, IHttpContextAccessor contextAccessor, IHostingEnvironment hostingEnvironment)
 {
     _logger              = loggerFactory.CreateLogger <TemplateController>();
     _session             = session;
     _httpContextAccessor = contextAccessor;
     _hostingEnvironment  = hostingEnvironment;
 }
Esempio n. 13
0
        public PmsDatabaseSessionFactory(string pmsConnection, ILoggerFactory factory)
        {
            if (pmsConnection == null)
            {
                throw new ArgumentNullException(nameof(pmsConnection));
            }
            if (string.IsNullOrWhiteSpace(pmsConnection))
            {
                throw new ArgumentException("Value cannot be whitespace.", nameof(pmsConnection));
            }


            _sessionFactory =
                Fluently.Configure()
                .Database(
                    () => SqlServerManagedDataClientConfiguration.SqlServer.ConnectionString(pmsConnection)
                    .AdoNetBatchSize(50)
                    ).Mappings(m => m.FluentMappings.AddFromAssemblyOf <PmsUnitOfWork>())
                .ExposeConfiguration(SchemaMetadataUpdater.QuoteTableAndColumns)
                .ExposeConfiguration(c => c.SetProperty("command_timeout", "60"))
                .ExposeConfiguration(c => c.SetInterceptor(
                                         new SqlStatementInterceptor(factory.CreateLogger <SqlStatementInterceptor>())))
                .BuildConfiguration()
                .BuildSessionFactory();
        }
Esempio n. 14
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory)
        {
            loggerFactory.AddLog4Net();
            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }
            var swaggerOptions = new Options.SwaggerOptions();

            Configuration.GetSection(nameof(SwaggerOptions)).Bind(swaggerOptions);

            app.UseSwagger(option => { option.RouteTemplate = swaggerOptions.JsonRoute; });
            app.UseSwaggerUI(option => option.SwaggerEndpoint(swaggerOptions.UIEndpoint, swaggerOptions.Description));

            app.UseStaticFiles();

            app.UseAuthentication();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
Esempio n. 15
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthorization();

            app.UseSession(); // put top of app.UseEndpoints and/or app.UseMvc();


            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });

            //app.UseMvc();
            loggerFactory.AddFile("Logs/myapp-{Date}.txt");
        }
Esempio n. 16
0
File: Seed.cs Progetto: ssteva/tuv
        // public Seed(UserManager<ApplicationUser> userManager, RoleManager<IdentityRole> roleManager, ISession session)
        // {
        //   _session = session;
        //   _roleManager = roleManager;
        //   _userManager = userManager;

        // }
        public Seed(KorisnikManager userManager, ISession session, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, IHostingEnvironment env)
        {
            _session     = session;
            _userManager = userManager;
            _logger      = loggerFactory.CreateLogger <Seed>();
            _env         = env;
        }
Esempio n. 17
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddFile("Logs/myapp-{Date}.txt");
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();
            app.UseSession();
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
Esempio n. 18
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            loggerFactory.AddLog4Net();

            //Cors
            app.UseCors(builder =>
            {
                builder.AllowAnyHeader();
                builder.AllowAnyMethod();
                builder.AllowAnyOrigin(); // For anyone access.
                                          //corsBuilder.WithOrigins("http://localhost:56573"); // for a specific url.
            });

            app.UseHttpsRedirection();

            app.UseRouting();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
            });
        }
Esempio n. 19
0
        public static async Task SeedAsync(IApplicationBuilder applicationBuilder, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, int?retry = 0)
        {
            var retryForAvaiability = retry.Value;

            try
            {
                using (var scope = applicationBuilder.ApplicationServices.CreateScope())
                {
                    var context = (UserContext)scope.ServiceProvider.GetService(typeof(UserContext));
                    var logger  = (ILogger <UserContextSeed>)scope.ServiceProvider.GetService(typeof(ILogger <UserContextSeed>));
                    logger.LogDebug("Begin UserContextSeed SeedAsync");
                    //获取到数据库的migrate
                    context.Database.Migrate();
                    if (!context.Users.Any())
                    {
                        context.Users.Add(new Model.AppUser {
                            Name = "lmc"
                        });
                        context.SaveChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                if (retryForAvaiability < 10)
                {
                    retryForAvaiability++;
                    var logger = loggerFactory.CreateLogger(typeof(UserContextSeed));
                    await SeedAsync(applicationBuilder, loggerFactory, retryForAvaiability);
                }
            }
        }
        public void NoClaims()
        {
            RequestResult <MSPVisitHistoryResponse> delegateResult = new RequestResult <MSPVisitHistoryResponse>()
            {
                ResultStatus    = Common.Constants.ResultType.Success,
                PageSize        = 100,
                PageIndex       = 1,
                ResourcePayload = new MSPVisitHistoryResponse()
                {
                    Claims = null,
                }
            };

            string hdid      = "MOCKHDID";
            string ipAddress = "127.0.0.1";

            using Microsoft.Extensions.Logging.ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddConsole());

            var mockMSPDelegate = new Mock <IMSPVisitDelegate>();

            mockMSPDelegate.Setup(s => s.GetMSPVisitHistoryAsync(It.IsAny <ODRHistoryQuery>(), It.IsAny <string>(), It.IsAny <string>())).Returns(Task.FromResult(delegateResult));

            RequestResult <PatientModel> patientResult = new RequestResult <PatientModel>()
            {
                ResultStatus    = Common.Constants.ResultType.Success,
                ResourcePayload = new PatientModel()
                {
                    PersonalHealthNumber = "912345678",
                    Birthdate            = DateTime.ParseExact("1983/07/15", "yyyy/MM/dd", CultureInfo.InvariantCulture)
                }
            };

            var mockPatientService = new Mock <IPatientService>();

            mockPatientService.Setup(s => s.GetPatient(It.IsAny <string>(), It.IsAny <PatientIdentifierType>())).Returns(Task.FromResult(patientResult));

            var mockHttpContextAccessor = new Mock <IHttpContextAccessor>();
            var context = new DefaultHttpContext()
            {
                Connection =
                {
                    RemoteIpAddress = IPAddress.Parse(ipAddress),
                },
            };

            context.Request.Headers.Add("Authorization", "MockJWTHeader");
            mockHttpContextAccessor.Setup(_ => _.HttpContext).Returns(context);


            IEncounterService service = new EncounterService(new Mock <ILogger <EncounterService> >().Object,
                                                             mockHttpContextAccessor.Object,
                                                             mockPatientService.Object,
                                                             mockMSPDelegate.Object);

            var actualResult = service.GetEncounters(hdid).Result;

            Assert.True(actualResult.ResultStatus == Common.Constants.ResultType.Success &&
                        actualResult.ResourcePayload.Count() == 0);
        }
Esempio n. 21
0
 public AreaRouter(
     Microsoft.AspNetCore.Mvc.Infrastructure.IActionInvokerFactory actionInvokerFactory,
     Microsoft.AspNetCore.Mvc.Infrastructure.IActionSelector actionSelector,
     System.Diagnostics.DiagnosticListener diagnosticListener,
     Microsoft.Extensions.Logging.ILoggerFactory loggerFactory)
     : this(actionInvokerFactory, actionSelector, diagnosticListener, loggerFactory, null)
 {
 }
Esempio n. 22
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         loggerFactory?.Dispose();
         loggerFactory = null;
     }
 }
Esempio n. 23
0
 /// <summary>
 /// Instantiates an authentication handler the can either use the device GUID, an API token or a JWT
 /// to authenticate requests to the API
 /// </summary>
 /// <param name="options"></param>
 /// <param name="logger"></param>
 /// <param name="encoder"></param>
 /// <param name="clock"></param>
 public JWTCookieAuthenticationHandler(
     IOptionsMonitor <AuthenticationSchemeOptions> options,
     ILoggerFactory logger,
     UrlEncoder encoder,
     ISystemClock clock)
     : base(options, logger, encoder, clock)
 {
     _logger = logger.CreateLogger <JWTCookieAuthenticationHandler>();
 }
Esempio n. 24
0
        public MicrosoftLoggerWrapper(Microsoft.Extensions.Logging.ILoggerFactory loggerFactory)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _innerLogger = loggerFactory.CreateLogger("Default");
        }
Esempio n. 25
0
        internal OwinLoggerFactory(Microsoft.Extensions.Logging.ILoggerFactory loggerFactory)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _loggerFactory = loggerFactory;
        }
Esempio n. 26
0
 public AreaRouter(
     Microsoft.AspNetCore.Mvc.Infrastructure.IActionInvokerFactory actionInvokerFactory,
     Microsoft.AspNetCore.Mvc.Infrastructure.IActionSelector actionSelector,
     System.Diagnostics.DiagnosticListener diagnosticListener,
     Microsoft.Extensions.Logging.ILoggerFactory loggerFactory,
     IActionContextAccessor actionContextAccessor)
     : base(actionInvokerFactory, actionSelector, diagnosticListener, loggerFactory, actionContextAccessor)
 {
 }
        public void ShouldGetMedications()
        {
            DateTime           loadDate = DateTime.Parse("2020/09/29");
            string             DIN      = "00000000";
            List <DrugProduct> fedData  = new List <DrugProduct>()
            {
                new DrugProduct()
                {
                    DrugIdentificationNumber = DIN,
                    UpdatedDateTime          = loadDate,
                }
            };

            List <PharmaCareDrug> provData = new List <PharmaCareDrug>()
            {
                new PharmaCareDrug()
                {
                    DINPIN          = DIN,
                    UpdatedDateTime = loadDate,
                },
            };

            Dictionary <string, Models.MedicationInformation> expected = new Dictionary <string, Models.MedicationInformation>()
            {
                {
                    DIN,
                    new Models.MedicationInformation()
                    {
                        DIN         = DIN,
                        FederalData = new FederalDrugSource()
                        {
                            UpdateDateTime = loadDate,
                            DrugProduct    = fedData.First(),
                        },
                        ProvincialData = new ProvincialDrugSource()
                        {
                            UpdateDateTime = loadDate,
                            PharmaCareDrug = provData.First(),
                        }
                    }
                }
            };

            Mock <IDrugLookupDelegate> mockDelegate = new Mock <IDrugLookupDelegate>();

            mockDelegate.Setup(s => s.GetDrugProductsByDIN(It.IsAny <List <string> >())).Returns(fedData);
            mockDelegate.Setup(s => s.GetPharmaCareDrugsByDIN(It.IsAny <List <string> >())).Returns(provData);

            using Microsoft.Extensions.Logging.ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddConsole());
            ILogger <RestMedicationService> logger = loggerFactory.CreateLogger <RestMedicationService>();

            IMedicationService service = new RestMedicationService(logger, mockDelegate.Object);
            var actual = service.GetMedications(new List <string>());

            Assert.True(actual.IsDeepEqual(expected));
        }
Esempio n. 28
0
        public Startup(IHostingEnvironment env, IConfiguration configuration, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory)
        {
            HostingEnvironment = env;
            LoggerFactory      = loggerFactory;
            Configuration      = configuration;

            Log.Logger = new LoggerConfiguration()
                         .ReadFrom.Configuration(configuration)
                         .CreateLogger();
        }
 public SecondController(ILoggerFactory loggerFactory, ILogger <SecondController> logger, ITestServiceA testServiceA, ITestServiceB testServiceB, ITestServiceC testServiceC, ITestServiceD testServiceD, IA ia, IUserService userService)
 {
     this._Factory       = loggerFactory;
     this._logger        = logger;
     this._ITestServiceA = testServiceA;
     this._ITestServiceB = testServiceB;
     this._ITestServiceC = testServiceC;
     this._ITestServiceD = testServiceD;
     this._IA            = ia;
     this._IUserService  = userService;
 }
Esempio n. 30
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            app.UseIISPlatformHandler();

            app.UseStaticFiles();
           
            app.UseMvc();
        }
Esempio n. 31
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            app.UseIISPlatformHandler();

            app.UseStaticFiles();

            app.UseMvc();
        }
Esempio n. 32
0
        internal OwinLoggerFactory(Microsoft.Extensions.Logging.ILoggerFactory loggerFactory)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _loggerFactory = loggerFactory;
        }