Closed robertmircea closed 3 years ago
@robertmircea we haven't tried it with .NET Core 3.0 preview packages but it should work since this is .NET Standard.
When you use UseServiceProviderFactory() method this package already supports .net core 3.0 latest version.
public static class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateWebHostBuilder(string[] args)
{
LoggingFacility.AddApplicationTag(typeof(Program).Assembly.GetName().Name);
LoggingFacility.AddEnvironmentTag();
return Host.CreateDefaultBuilder(args)
.UseServiceProviderFactory(new WindsorServiceProviderFactory())
.ConfigureWebHostDefaults(builder =>
{
builder.UseStartup<Startup>()
.UseAppMetrics()
.UseKestrel(options => options.AddServerHeader = false)
.UseLogFactory()
.UseIIS()
.UseIISIntegration();
});
}
}
In Startup.cs void ConfigureServices(IServiceCollection services) method register your windsor container instance with services.AddSingleton
@gokhanabatay Where is the "locFacility.Container" coming from in the Startup.cs void ConfigureServices method from your example? Is there a working demo anywhere I could reference?
Hi @chrisheil
@gokhanabatay Where is the "locFacility.Container" coming from in the Startup.cs void ConfigureServices method from your example? Is there a working demo anywhere I could reference?
IocFacility.Container is a public static singleton WindsorContainer instance, key point is use of UseServiceProviderFactory(new in .net core 3.0) in Program.cs. All u need is above Program.cs and Startup.cs register singleton instance of WindsorContainer as sigleton to IServiceCollection.
Hi @gokhanabatay, I also can not find IocFacility.Container
reference on startup.
I tried on https://github.com/aspnetboilerplate/module-zero-core-template with
services.AddSingleton(IocManager.Instance.IocContainer);//its IWindsorContainer reference
and problem still exists. What is your project?
@demirmusa were you able to make it work?
How can I use this library with .net core 3.0? Is there any sample code on how to configure host and asp.net core mvc?