dna-framework
dna-framework copied to clipboard
Use ASP.NET Core 3
I've updated my server project to ASP.NET Core 3 and have tried to implement Dna.Framework.AspNet. I've followed this guide and made the following changes related to Dna:
Program.cs
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseDnaFramework(construct =>
{
// Add file logger
construct.AddFileLogger();
});
webBuilder.UseStartup<Startup>();
});
It builds and runs, but the DI shortcuts don't work (ie. DI.ApplicationDbContext) and throws System.InvalidOperationException: 'Cannot resolve scoped service 'xxx.ApplicationDbContext' from root provider.'
Any ideas?
@lorentzfb Hi, Did you find a solution for this problem?
For 3.0 and up, you need to use the IApplicationBuilder.
public void Configure(IApplicationBuilder app) { app.UseDnaFramework() }