Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move all projects to generic host & remove IConfigurationAccessor usage. #1894

Merged
merged 6 commits into from
Oct 18, 2019

Conversation

maliming
Copy link
Member

@maliming maliming commented Oct 11, 2019

This resolve #1888 , resolve #1094

Refactoring AbpAspNetCoreIntegratedTestBase based on generic WebHost

https://github.com/abpframework/abp/pull/1894/files#diff-2bdeefcb05a7d19d5c4233f0ebc10c12R24

@maliming maliming closed this Oct 11, 2019
@hikalkan hikalkan modified the milestone: 0.22 Oct 11, 2019
@maliming maliming reopened this Oct 11, 2019
@maliming
Copy link
Member Author

hi @hikalkan
The current situation is that we can't get IConfiguration under the module's ConfigureServices method.

Currently using the following method to get IConfiguration, but this will be out of date.

var configuration = context.Services.BuildConfiguration();

Although can inject IConfiguration in the Startup class, this can't be integrated with abp.

@hikalkan hikalkan added this to the 1.0 milestone Oct 13, 2019
@hikalkan
Copy link
Member

Can you try this in ConfigureServices: context.Services.GetSingletonInstance<IConfiguration>()

@maliming
Copy link
Member Author

Actually I tried. I can't get IConfiguration or IConfigurationRoot like IWebHostEnvironment.

Could not find singleton service: Microsoft.Extensions.Configuration.IConfiguration, Microsoft.Extensions.Configuration.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60

Could not find singleton service: Microsoft.Extensions.Configuration.IConfigurationRoot, Microsoft.Extensions.Configuration.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60

@hikalkan
Copy link
Member

OK, let me check this.

@hikalkan
Copy link
Member

var config = context.Services.GetSingletonInstanceOrNull<HostBuilderContext>().Configuration

should work. I changed services.GetConfiguration() to use the code above (see 0f24054), so you can use context.Services.GetConfiguration() just like before in ConfigureServices method.

Merge dev to your branch to be able to use it.

@maliming
Copy link
Member Author

All done.

@hikalkan hikalkan merged commit f62771b into dev Oct 18, 2019
@maliming maliming deleted the maliming/GenericHost branch October 18, 2019 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move all projects to generic host & remove IConfigurationAccessor usage Configuration redesign
2 participants