November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Hi,
You can add the module dependency like this:
[ModuleDependency(typeof(Mediachase.Commerce.Initialization.CommerceInitialization))] [InitializableModule] public class MyCurrentMarketModule
This will make sure your module runs after CommerceInitialization, then override the registration.
Regards.
/Q
Thanks, this worked perfectly.
I suggest you add that line to the documentation i read here as well:
http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Commerce/8/Markets/Markets/
because that code does not work correctly without specifying that module dependency.
Hello everyone.
I'm currently running EPiServer Commerce 8.13.0 and I'm trying to implement my own ICurrentMarket module through the instructions here: http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Commerce/8/Markets/Markets/
I have tried to copy this code:
But later when I run ServiceLocator.GetInstance(); an instance of CurrentMarketImpl is still returned and my market logics are not being used.
I found out this is because EPiServer registers CurrentMarketImpl as the implementation for ICurrentMarket AFTER I've registered my own. So structuremap returns the one registered last.
A workaround I have found is to configure the container in the
public void Initialize(InitializationEngine context)
method instead of the
public void ConfigureContainer(ServiceConfigurationContext context)
that will fire AFTER EPiServer has registered CurrentMarketImpl as the implementation for ICurrentMarket and therefore override it with my own logic.
But this does not feel like the right thing to do, there must be something else I've missed to done incorrectly?
Is there an option somewhere to enable multi market/disable CurrentMarketImpl that I've missed or what is wrong here? Is the documentation for ICurrentMarket incorrect?