Closed jptissot closed 5 years ago
@laguer71 okay i will try tomorrow this usage of .WithTenants()
and then ConfiguredFeaturesShellDescriptorManager
.
@laguer71
Fixed
It is not related to 3.0 but since we did IShellConfiguration
, so can you file another issue on which i will add comments e.g on how to preconfigure tenants (when using .WithTenants
) through an appsettings.json
(no more a root tenants.json
) under an OrchardCore
section.
As a reminder, IShellConfiguration
is a singleton but a tenant singleton, and here ConfiguredFeaturesShellDescriptorManager
(that injects IShellConfiguration
) is registered as a scoped service but at the application level. So the issue Some services are not able to be constructed
.
One fix was to inject IConfiguration
and do a .GetSection("OrchardCore")
on it. But better was to register ConfiguredFeaturesShellDescriptorManager
at the tenant level with our app level helper.
builder.ConfigureServices(s =>
{
s.AddScoped<IShellDescriptorManager, ConfiguredFeaturesShellDescriptorManager>();
});
In place of
builder.ApplicationServices.AddScoped<IShellDescriptorManager, ConfiguredFeaturesShellDescriptorManager>();
I will do a PR soon.
TY Jean! Openend the Issue in https://github.com/OrchardCMS/OrchardCore/issues/4321
I haven't seen any other issues on my end. Feel free to close this one :) Thanks for all the comments guys!
What should be the dependency resolution for private readonly IOrchardHelper _helper; private readonly IQueryManager _queryManager;
public void ConfigureServices(IServiceCollection services)
{
services.AddOrchardCms();
}
https://docs.orchardcore.net/en/dev/docs/guides/decoupled-cms/
Will document issues I find when moving to Core 3.0 here.