I'm running into this problem where our custom shipping calculator doesn't kick in after a deployment. It only starts to calculate shipping after restarting the site in IIS after every deployment (I also clear the cache, delete the temp folders and recycle the app pool). After doing this it works fine, but it's not an ideal solution
The calculator is registered as mentioned in the docs:
[RuntimeLevel(MinLevel = RuntimeLevel.Run)]
public class ServiceComposer : IUserComposer
{
public void Compose(Composition composition)
{
composition.RegisterUnique<IShippingCalculator, MyShippingCalculator>();
}
}
And the implementation is fairly simple. We just call our shipping service:
Hi all and appologies for digging up a dead thread - trying to do something similar here, however could you tell me what to reference in order to get ShippingService that is being injected here?
I believe in this instance ShippingService is their own service that is responsible for calculating shipping for their needs, so it's something they have implemented and added to the DI container.
Shipping Calculator not kicking in
Hey,
I'm running into this problem where our custom shipping calculator doesn't kick in after a deployment. It only starts to calculate shipping after restarting the site in IIS after every deployment (I also clear the cache, delete the temp folders and recycle the app pool). After doing this it works fine, but it's not an ideal solution
The calculator is registered as mentioned in the docs:
And the implementation is fairly simple. We just call our shipping service:
I put some logging in and found just doesn't hit CalculateShippingMethodPrice() and instead just falls back to the default shipping price
This is using Vendr 1.2.10
Any ideas what it could be?
Cheers, Mark V
Hi Mark,
My guess is that you are missing the ComposeAfterAttribute to tell your composer to run after ours and so yours is running first and so getting overridden https://vendr.net/docs/core/1-3-0/key-concepts/dependency-injection/#registering-dependencies
Try adding the attribute and see if that helps.
Matt
Hi all and appologies for digging up a dead thread - trying to do something similar here, however could you tell me what to reference in order to get ShippingService that is being injected here?
I'm unable to get GetShippingPrice to work...
Thank you
I believe in this instance
ShippingService
is their own service that is responsible for calculating shipping for their needs, so it's something they have implemented and added to the DI container.Ah that makes more sense, thank you
Hey,
Yep, that's done it thank you!
Turns out I missed this step
Cheers, Mark V
is working on a reply...