Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
If you're creating a bug/problem report, please include followings:
- ABP Framework version: v4.3.0
- UI type: Blazor
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): yes
-
- Exception message and stack trace:
- Steps to reproduce the issue:"
We are unable to get dependency injection of ISettingManager in the constructor of a Blazor component we created to configure the settings for a module.
The module which uses the ISettingManager is as follows:
This has worked in a separate ABP Blazor solution, but in this case we have it in a separate module in another ABP solution and when visiting the respective page we get this error:
10 Answer(s)
-
0
Hi, I guess you've created a new module and want to use the
ISettingManager
on it, right?If so, please ensure you added the related depends on statement to your module class (ensure your domain module depends on the
AbpSettingManagementDomainModule
([DependsOn(typeof(AbpSettingManagementDomainModule))])). -
0
Hi, I guess you've created a new module and want to use the
ISettingManager
on it, right?If so, please ensure you added the related depends on statement to your module class (ensure your domain module depends on the
AbpSettingManagementDomainModule
([DependsOn(typeof(AbpSettingManagementDomainModule))])).That is correct, I've created a new Module using ABP Suite and want to setup Settings specifically within that module.
I've already added that dependency to the Module's Domain Module:
-
0
-
0
I was wondering if it could be because it was a long-lived ABP solution and we did a lot of changes to it. But I created a brand new ABP Solution and created a module within that Solution and tried again and still couldn't get ISettingManagement to work in the module.
btw, I used ABP suite to create this module within the solution (both times) using this button:
-
0
I was wondering if it could be because it was a long-lived ABP solution and we did a lot of changes to it. But I created a brand new ABP Solution and created a module within that Solution and tried again and still couldn't get ISettingManagement to work in the module.
btw, I used ABP suite to create this module within the solution (both times) using this button:
Hi, yes it might be related to your changes but it's weird to see this problem in a brand new solution. I'll test and write you back within the day. Sorry for the delay.
-
0
Hi, were you able to replicate the issue? Or are you able to get ISettingManager in a module instantiated in an ABP solution?
-
0
The module which uses the ISettingManager is as follows:
Can you use the
Inject
attribute instead of constructor injection as below and try again:public partial class NewsSettingGroupComponent { [Inject] public ISettingManager SettingManager {get; set;} }
Btw, to be able to use the
ISettingManager
in the blazor project, your project should depends on SettingManagement.Domain package (directly or indirectly). -
0
Hi,
I tried using the Inject attribute and it still didn't work.
I've reproduced the error on a clean ABP Solution, here is the link: https://github.com/maksym-gryb/ABPTestSolution
Please try it out and let me know how we can resolve this issue in our codebase.
-
0
Hi,
I tried using the Inject attribute and it still didn't work.
I've reproduced the error on a clean ABP Solution, here is the link: https://github.com/maksym-gryb/ABPTestSolution
Please try it out and let me know how we can resolve this issue in our codebase.
Thanks, I'll clone your repository and try to reproduce it.
-
0
Hi, I examine your project and find a small problem. It seems your blazor project (
TestModuleABlazorModule
) depends on your domain project (TestModuleADomainModule
) and it should not be like that. Instead, you should create an application service and use theISettingManager
on it.Then, use the application service interface instead the
ISettingManager
.
For an example please check the below links:
1-) Using
ISettingManager
in an application service -> https://github.com/abpframework/abp/blob/dev/modules/setting-management/src/Volo.Abp.SettingManagement.Application/Volo/Abp/SettingManagement/EmailSettingsAppService.cs#L132-) Using the related application service in the setting management group -> https://github.com/abpframework/abp/blob/dev/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/EmailSettingGroup/EmailSettingGroupViewComponent.razor.cs#L17