26.12.2017, 19:11 | #1 |
Участник
|
a33ik: Singleton pattern template
Источник: http://daxonline.org/1600-singleton-...-template.html
============== 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() { }} Источник: http://daxonline.org/1600-singleton-...-template.html |
|
|
|