OrchardCore.Commerce icon indicating copy to clipboard operation
OrchardCore.Commerce copied to clipboard

`OrchardCore.Commerce.ContentFields` is missing an `OrchardCore.Commerce` dependency (OCC-326)

Open Piedone opened this issue 10 months ago • 2 comments

Describe the bug

OrchardCore.Commerce.ContentFields doesn't depend on OrchardCore.Commerce but uses services from it.

To Reproduce

Steps to reproduce the behavior:

  1. Enable OrchardCore.Commerce.ContentFields.
  2. E.g. go to /Admin/ContentTypes/List.
  3. Observe the below exception due to PriceFieldSettingsDriver unable to resolve IMoneyService.
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

Jira issue

Piedone avatar Mar 11 '25 21:03 Piedone

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.

sarahelsaig avatar Mar 29 '25 00:03 sarahelsaig

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.

Piedone avatar May 11 '25 15:05 Piedone