class SingletonClass { public static SingletonClass instance() { SingletonClass singleton; // AX2012 //SysGlobalCache globalCache = infolog.objectOnServer() ? appl.globalCache() : infolog.globalCache(); // AX7/d365 SysGlobalCache globalCache = appl.globalCache(); if (globalCache.isSet(classStr(SingletonClass), 0)) { singleton = globalCache.get(classStr(SingletonClass), 0); } else { singleton = new SingletonClass(); // Additional line for AX2012 //infoLog.globalCache().set(classStr(SingletonClass), 0, singleton); appl.globalCache().set(classStr(SingletonClass), 0, singleton); } return singleton; } // Should be private, but AX7/D365 gives BP error protected void new() { } }Alternative: Context and System.IDisposable
DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.
Authors are allowed to set their own AdSense units.
Join us.