v10.2.0 Angular .net5 abp v 6.2.0
I had a longer version of this typed up but my session was lost and along with it my original post, so here's the boiled down version.
A complete version of IConfiguration is not available to my class libraries without adding services.AddSingleton<IConfiguration>(configuration);
to Startup.ConfigurServices. Without that line IConfiguration only has a single provider for environment variables. When I add the line I get a fully populated instance of IConfiguration. Prior to aspnetcore2 explicitly configuring IConfiguration for the container with aforementioned line was required, without it the injected instance would be null (such is my understanding, I never used netcore1.x versions). Starting with aspnetcore2 IConfiguration should be implicitly configured and services.AddSingleton<IConfiguration>(configuration);
should not be necessary, but in A0 it seems to be.
I can find no documentation for A0 nor ABP that details this. Is this by design or a bug? If the former, can you elaborate on the reasoning and intention?
Here's what the IConfiguration instance looks like without explicitly adding it to the container:
3 Answer(s)
-
0
Hi,
AspNet Zero uses
IAppConfigurationAccessor
to support accessing/mocking configuration in Test project and other project types. You can injectIAppConfigurationAccessor
and use it. -
0
So is A0 somehow removing the implicit configuration for IConfiguration? What is the reasoning behind this?
-
0
Hi @tusksoft
I got the problem now. Normally it shouldn't be like this. I will check it and get back to you.