OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.43k stars 2.4k forks source link

Core 3.0 update thread #4261

Closed jptissot closed 5 years ago

jptissot commented 5 years ago

Will document issues I find when moving to Core 3.0 here.

jtkech commented 5 years ago

@laguer71 okay i will try tomorrow this usage of .WithTenants() and then ConfiguredFeaturesShellDescriptorManager.

jtkech commented 5 years ago

@laguer71

Fixed

Tenants

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.

laguer71 commented 5 years ago

TY Jean! Openend the Issue in https://github.com/OrchardCMS/OrchardCore/issues/4321

jptissot commented 5 years ago

I haven't seen any other issues on my end. Feel free to close this one :) Thanks for all the comments guys!

pavanshankar5 commented 4 years ago

image What should be the dependency resolution for private readonly IOrchardHelper _helper; private readonly IQueryManager _queryManager;

dodyg commented 4 years ago
public void ConfigureServices(IServiceCollection services)
{
    services.AddOrchardCms();
}

https://docs.orchardcore.net/en/dev/docs/guides/decoupled-cms/