How do I get orders from backend, when I don't have an Umbraco context. Both TC.GetOrder and TeaCommerceHelper.GetOrders throws error because context is missing
It turns out that DatabaseFactory in TeaCommerce.Umbraco.Configuration.dll relies on httpcontext for caching a request based database object. Could you maybe do one of the following:
1. Check to see if HttpContext.Current is null and then just return the Database with out caching - otherwise do it the old way 2. Change DB access to use the new Umbraco 6.x ApplicationContext.Current.DatabaseContext.Database
I implemented my own version of IDatabaseFactory, and initialized an OrderRepository with an instance of that. It works but I think it's a bit hacky. Please make TC not dependent of HttpContext
Is it the fileversion that determines the TC version - or can I see it somewhere else? If so I'll have to upgrade from 2.0.0 to 2.2.4 - how much work is involved :)
What is your use case for calling Tea Commerce with no HttpContext in scope? Trying to figure out what you are doing since TC has lots of HttpContext usage.
A late response, buth I just hit the same need again, and found my own old post :)
I need access to TC api from a background thread that synchronizes orders to a customers ERP system, and now I need to send a follow-up email 7 days after the did some shopping
How to get orders from .NET without context
Hi
How do I get orders from backend, when I don't have an Umbraco context. Both TC.GetOrder and TeaCommerceHelper.GetOrders throws error because context is missing
/Bo
Update:
It turns out that DatabaseFactory in TeaCommerce.Umbraco.Configuration.dll relies on httpcontext for caching a request based database object. Could you maybe do one of the following:
1. Check to see if HttpContext.Current is null and then just return the Database with out caching - otherwise do it the old way
2. Change DB access to use the new Umbraco 6.x ApplicationContext.Current.DatabaseContext.Database
/Bo
Solution:
I implemented my own version of IDatabaseFactory, and initialized an OrderRepository with an instance of that. It works but I think it's a bit hacky. Please make TC not dependent of HttpContext
/Bo
Fixed it in Tea Commerce 2.2.4 (which just started). Do you want a nightly - then just send your email adress.
Kind regards
Anders
Is it the fileversion that determines the TC version - or can I see it somewhere else? If so I'll have to upgrade from 2.0.0 to 2.2.4 - how much work is involved :)
/Bo
The file version always say 2.0 so look in Umbraco - installed packages. There you have the right number.
Ok, then it's 2.1.3.
You can email me at: bo at flex-it dot dk
TIA
/Bo
Hi Bo
What is your use case for calling Tea Commerce with no HttpContext in scope?
Trying to figure out what you are doing since TC has lots of HttpContext usage.
Kind regards
Anders
Hi Anders
A late response, buth I just hit the same need again, and found my own old post :)
I need access to TC api from a background thread that synchronizes orders to a customers ERP system, and now I need to send a follow-up email 7 days after the did some shopping
/Bo
Hi again
I seems to still be an issue in 2.3.0
/Bo
Hi Bo
I think we removed it again because we open sourced v 3 of Tea Commerce on GitHub and people can now make their own implementation of it.
https://github.com/TeaCommerce/Tea-Commerce-for-Umbraco/blob/master/Source/TeaCommerce.Umbraco.Configuration/Persistence/DatabaseFactory.cs
Do you need it to be 2.3?
Kind regards
Anders
is working on a reply...