Why aren't the CustomOrderLineCalculator run on HTTP thread
Why do the CustomOrderLineCalculators do not run on the same HTTP thread as the website. This brings some large issues on a site we are working on.
First: we cannot seem to debug the Custom OrderLineCalculators using Visual Studio. It will just not hit the breakpoint.
Second: We have the following requirement. Members all have separate discount rules with complicated logic behind them. Which says:
User A can buy this product this month with 12% discount, but User B can buy this product with 16% discount.
These rules are all created on the fly using data from the Member and previous order data, other members and some external factors. This is not a problem, we cache all this information in the website using the HttpRuntime.Cache which we refresh when we have new information. This works flawlessly.
However when trying to access the cache in the CustomOrderLineCalculator, it is always empty. This is a problem, because building up this cache takes a couple of seconds. Every time the CustomOrderLineCalculator runs (and that is a lot of times on a large order) this will be rebuild.
I've even tried using only the MemberShipService to get the required data from the member in the CustomOrderLineCalculator, however this is not quite fast enough.
Actually, I did some more research and found out something stranger is happening. The custom order line calculators can access the HttpRuntime.Cache, however when converting the items in the cache to the correct (custom) objects gives some strange problems:
System.InvalidCastException: [A]Models.BusinessPartnerModel cannot be cast to [B]Models.BusinessPartnerModel. Type A originates from 'Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'Default' at location 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\954409ca\e56b7dd7\assembly\dl3\8b57eec2\940aaf10_c97bd201\Models.dll'. Type B originates from 'Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'LoadNeither' in a byte array.
But, this seems to be the case because the custom classes are in the same assembly as the Umbraco project. When I extract them into a separate project everything seems fine.
However I still cannot debug the custom order line calculators.
Why aren't the CustomOrderLineCalculator run on HTTP thread
Why do the CustomOrderLineCalculators do not run on the same HTTP thread as the website. This brings some large issues on a site we are working on.
First: we cannot seem to debug the Custom OrderLineCalculators using Visual Studio. It will just not hit the breakpoint.
Second: We have the following requirement. Members all have separate discount rules with complicated logic behind them. Which says: User A can buy this product this month with 12% discount, but User B can buy this product with 16% discount.
These rules are all created on the fly using data from the Member and previous order data, other members and some external factors. This is not a problem, we cache all this information in the website using the HttpRuntime.Cache which we refresh when we have new information. This works flawlessly.
However when trying to access the cache in the CustomOrderLineCalculator, it is always empty. This is a problem, because building up this cache takes a couple of seconds. Every time the CustomOrderLineCalculator runs (and that is a lot of times on a large order) this will be rebuild.
I've even tried using only the MemberShipService to get the required data from the member in the CustomOrderLineCalculator, however this is not quite fast enough.
Is there anything I can do to improve this?
Actually, I did some more research and found out something stranger is happening. The custom order line calculators can access the HttpRuntime.Cache, however when converting the items in the cache to the correct (custom) objects gives some strange problems:
System.InvalidCastException: [A]Models.BusinessPartnerModel cannot be cast to [B]Models.BusinessPartnerModel. Type A originates from 'Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'Default' at location 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\954409ca\e56b7dd7\assembly\dl3\8b57eec2\940aaf10_c97bd201\Models.dll'. Type B originates from 'Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'LoadNeither' in a byte array.
But, this seems to be the case because the custom classes are in the same assembly as the Umbraco project. When I extract them into a separate project everything seems fine.
However I still cannot debug the custom order line calculators.
Any ideas on that?
Please send email with contact info to [email protected], so we can send you Tea Commerce 3.2.2 and see if that fixes the bug. It should :)
Fixed in Tea Commerce 3.2.2
Thanks! This makes live so much easier. Just tested it on a project.
is working on a reply...