OrchardCMS / OrchardCore.Samples

Modules and Multi-Tenancy in ASP.NET samples using the Orchard Core framework
BSD 3-Clause "New" or "Revised" License
383 stars 131 forks source link

IShellSettingsConfigurationProvider problem with multi-tenant in Core 2.0 #1

Closed crowcoder closed 7 years ago

crowcoder commented 7 years ago

Working with Modules in Asp.Net Core 2.0 I get the error below when I enable WithTenants. The sample in this repo does work, but enabling tenants in Core 2.0 does not. Is there something else to do here or is multi-tenancy not yet available with 2.0?

services.AddModules( c => c.WithTenants());

System.InvalidOperationException: 'Cannot consume scoped service 'Orchard.Environment.Shell.IShellSettingsConfigurationProvider' from singleton 'Orchard.Environment.Shell.IShellSettingsManager'.

image

(@contrivedex on twitter)

sebastienros commented 7 years ago

What was the issue?

crowcoder commented 7 years ago

I did not get it worked out, I reverted back to the NuGet package versions that were current at the time of the youtube video. I think the MyGet feeds are maybe not all synced up because the OrchardCore github repo obviously works, but trying to setup a stand-alone project for just module functionality wasn't working for me because of NuGet version references.

The c => c.WithTenants() works in a .Net Standard 1.6 project but I got the error reported above on 2.0.

However, tenancy (in Core v1.6) isn't restricting modules (Features) by tenant. I can tell it is doing something since the proper route works, but I can still access any module from any tenant.

Maybe I will create a minimal repo that reproduces the behavior when I get home from work.

I have enough material for my code camp presentation so no emergencies, especially since my problems are probably just my own mistakes.

Thank you for checking!

sebastienros commented 7 years ago

Thanks for reporting, I'll check it too. We renamed the packages and I might have broken something with references ...