CMS 9 & check CurrentITransferContext

Vote:
 

Hi all,

I've updated to CMS 9 and the line below, which I use to check that the page is not currently being imported/mirrored during page events, no longer works. 

EPiServer.BaseLibrary.Context.Current["CurrentITransferContext"] != null

Does anyone know what is now the best way to check whether the current context is importing?

Many thanks,

Steven

#140907
Nov 03, 2015 16:19
Vote:
 

Hi,

It looks like this property was moved to ContextCache.

You could try to use one of two options. Use the CurrentContext static property of ExportImportBase class.

 var transferContext = EPiServer.Enterprise.ExportImportBase.CurrentContext;

or call ContextCache directly.

var transferContext = EPiServer.Framework.ContextCache.Current["CurrentITransferContext"];

The EPiServer.Enterprise.ExportImportBase.CurrentContext has the implementation that executes EPiServer.Framework.ContextCache.Current["CurrentITransferContext"]

#140920
Nov 03, 2015 20:01
Vote:
 

Just a heads-up, mirroring is obsoleted in EPiServer 9. Please see http://world.episerver.com/documentation/Items/Upgrading/EPiServer-CMS/9/Breaking-changes/

#140924
Nov 03, 2015 22:09
Vote:
 

Thank you Grzegorz! That's exactly what I was looking for.

@Johan, is it actually being made obsolete? I understood it that its just incompatible with previous versions, though I haven't tried it yet. I should be able to try using the updated DLL soon and will report back with any issues.

#140946
Nov 04, 2015 15:45
Vote:
 

Ah, my fault. Yep seems to still work, just need to update the package since they have moved stuff arround.

#140947
Nov 04, 2015 15:49
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.