`OrchardCore.Commerce.ContentFields` is missing an `OrchardCore.Commerce` dependency (OCC-326)
Describe the bug
OrchardCore.Commerce.ContentFields doesn't depend on OrchardCore.Commerce but uses services from it.
To Reproduce
Steps to reproduce the behavior:
- Enable
OrchardCore.Commerce.ContentFields. - E.g. go to /Admin/ContentTypes/List.
- Observe the below exception due to
PriceFieldSettingsDriverunable to resolveIMoneyService.
Unable to resolve service for type 'OrchardCore.Commerce.MoneyDataType.Abstractions.IMoneyService' while attempting to activate 'OrchardCore.Commerce.Settings.PriceFieldSettingsDriver'.
Note that this might not be the only case. I suggest checking all features to see if there are missing dependencies, because it seems there are. E.g. OrchardCore.Commerce.Inventory and OrchardCore.Commerce.Payment misses dependencies in their root features too.
Expected behavior
No exceptions due to missing services.
Screenshots
N/A
TODO: Review all services registered in OrchardCore.Commerce/Startup.cs. Investigate if they are used in one of the other OrchardCore.Commerce.* projects. Check if they can be moved over into that project. If not (circular dependencies or multiple consuming projects) then move their service registration into a separate startup class with [RequireFeatures(NameOfConsumingProject)]. See the existing InventoryStartup for reference.
An
Unable to resolve service for type 'OrchardCore.Commerce.Abstractions.IShoppingCartPersistence' while attempting to activate 'OrchardCore.Commerce.Drivers.ShoppingCartWidgetPartDisplayDriver'.
exception can be caused due to a similar issue.