System.NullReferenceException: Object reference not set to an instance of an object.
at TeaCommerce.Api.Web.Infrastructure.Licensing.TopLevelDomainLicense.IsFeatureLicensed(Feature feature)
at TeaCommerce.Api.Infrastructure.Licensing.LicenseService.ValidateLicenseFeatures(Feature[] features)
at TeaCommerce.Api.Models.Order.Save()
We have the license, im guessing its because there is no available httpcontext, but since the TeaCommerce.Api is not on Github i cannot check thi out. Do you have any other trick to change this order status? Old SQL? Or another way to save an order?
Yes, you are exactly right. We are depending on the HttpContext.Current, and it must be missing in your case.
Then how to do it...
You can edit in the DB directly, but be aware that Tea Commerce is caching the orders in the application cache, when going through C# TC.whatever and through the javascript API. You will have to clear the application cache if you are changing orders that could be found in the cache.
That was actually a good question. Basically Tea Commerce caches all orders in the MemoryCache and is using a sliding expiration of a default 10 minutes. You can clear all orders by calling the Tea Commerce CacheService:
TeaCommerce.Api.Infrastructure.Caching.CacheService.Invalidate( string cacheKey );
Order.Save fires null reference when used with hangfire
Hey Guys :)
We are just doing a super TC solution with a integration for C5 here we have an event being fired by Hangfire.
When an order has been handled we want to change its order status like this:
But it throws the following error:
We have the license, im guessing its because there is no available httpcontext, but since the TeaCommerce.Api is not on Github i cannot check thi out. Do you have any other trick to change this order status? Old SQL? Or another way to save an order?
Hi Rasmus,
Yes, you are exactly right. We are depending on the HttpContext.Current, and it must be missing in your case.
Then how to do it...
You can edit in the DB directly, but be aware that Tea Commerce is caching the orders in the application cache, when going through C# TC.whatever and through the javascript API. You will have to clear the application cache if you are changing orders that could be found in the cache.
/Rune
Hi Rune,
what exactly do you mean by application-cache. Do you have a code-example on how to clear the TC cache?
Regards René
Hi René
That was actually a good question. Basically Tea Commerce caches all orders in the MemoryCache and is using a sliding expiration of a default 10 minutes. You can clear all orders by calling the Tea Commerce CacheService: TeaCommerce.Api.Infrastructure.Caching.CacheService.Invalidate( string cacheKey );
The cache key for orders is: "Orders-[storeId]"
/Rune
is working on a reply...