>goApp.setDatasession(set("datasession")) >goApp.oData.getSomeData()... >goApp.resetDatasession() >>
*Some method LOCAL loSetDataSession SET CLASSLIB TO somevcx.vcx loSetDataSession = CreateObject("cusPushPopSetTo","DATASESSION") *Do some thing RETURN && data session is reset at this point.However, doing that code exactly like that means I cannot subclass the cusPushPopSetTo nor rearrange my classlibs.
LOCAL m.loSetDataSession m.loSetDataSession = ; oFactory.New(SET("DATASESSION"),; "alias for cusPushPopSetTo class",; "DATASESSION")<pre> I could use a udf to avoid passing the current datasession, but there's not much point to that, but it would be something like this (not tested). <pre>NewObjectX.prg lparameters m.tcClassAlias,m.tuParm1,...m.tuParm23 LOCAL lcParms lcParms = x5pitems("m.tuParm1,...m.tuParm23",PCOUNT()) Return EVALUATE([oFactory.New(SET("DATASESSION"),m.tcClassAlias,] + m.lcParms +[)]