0

I'm importing products into a Sitecore uCommerce site and referencing these new products using the uCommerce Sitecore data provider.

The products are successfully imported and show in the uCommerce interface but they don't immediately show in the products bucket (Sitecore/uCommerce/Products).

I've tried:

 - ObjectFactory.Instance.Resolve<ICacheProvider>().ClearCache();
 - ObjectFactory.Instance.Resolve<ScratchIndexer>().Index();
 - Clearing all the sitecore caches (cache.aspx)

but none of these work.

As soon as I recycle the app pool they appear as expected.

Is there something else I need to call from my import code to make the data provider work without a recycle?

2 Answers 2

1

I peeked inside the uCommerce Sitecore DLLs and found the class DataProviderReinitializeTask<T> which contained code for clearing the dataprovider cache.

To use in any location you'll need code like this:

var context = ObjectFactory.Instance.Resolve<UCommerce.Sitecore.ISitecoreContext>();
var dataProviderMaster = context.DataProviderMaster;
if (dataProviderMaster != null)
    dataProviderMaster.DataChangedPleaseReinitialize();
0

You would also need to clear the NHibernate caches. So, run this code and you should be all set.

// uCommerce NHibernate Cahce ObjectFactory.Instance.Resolve().ClearCache();

// Clear product data provider cache var sitecoreContext = ObjectFactory.Instance.Resolve(); sitecoreContext.DataProviderMaster.DataChangedPleaseReinitialize();

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.