public static IHost CreateHost( Action <ContainerBuilder> containerOverrides = null, Action <IServiceCollection> servicesOverrides = null) { var serviceProviderFactory = new AppServiceProviderFactory(containerOverrides, servicesOverrides); Log.Logger = LoggingHelper.CreateLogger(); var hostBuilder = new HostBuilder() .UseSerilog((hostingContext, loggerConfiguration) => { loggerConfiguration .ReadFrom.Configuration(hostingContext.Configuration) .Enrich.FromLogContext() .Enrich.WithProperty("ApplicationName", "ApiTemplate") .Enrich.WithProperty("Environment", hostingContext.HostingEnvironment); #if DEBUG // Used to filter out potentially bad data due to debugging. // Very useful when doing Seq dashboards and want to remove logs under debugging session. loggerConfiguration.Enrich.WithProperty("DebuggerAttached", Debugger.IsAttached); #endif }) .UseServiceProviderFactory(serviceProviderFactory) .ConfigureWebHostDefaults(webHost => { webHost //.ConfigureLogging(builder => builder.AddSeq()) .UseTestServer() .UseConfiguration(Configuration) .UseEnvironment(EnvironmentName) .UseStartup <Startup>(); }); return(hostBuilder.Start()); }
public TestDbContextOperations( IOperationReporter reporter, Assembly assembly, Assembly startupAssembly, AppServiceProviderFactory appServicesFactory) : base(reporter, assembly, startupAssembly, appServicesFactory) { }
public TestDbContextOperations( IOperationReporter reporter, Assembly assembly, Assembly startupAssembly, string projectDir, string rootNamespace, string language, bool nullable, string[] args, AppServiceProviderFactory appServicesFactory) : base(reporter, assembly, startupAssembly, projectDir, rootNamespace, language, nullable, args, appServicesFactory) { }
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> protected DbContextOperations( IOperationReporter reporter, Assembly assembly, Assembly startupAssembly, string projectDir, string?rootNamespace, string?language, bool nullable, string[]?args, AppServiceProviderFactory appServicesFactory) { _reporter = reporter; _assembly = assembly; _startupAssembly = startupAssembly; _projectDir = projectDir; _rootNamespace = rootNamespace; _language = language; _nullable = nullable; _args = args ?? Array.Empty <string>(); _appServicesFactory = appServicesFactory; _servicesBuilder = new DesignTimeServicesBuilder(assembly, startupAssembly, reporter, _args); }