I’ve been very successful up to this point with my VS project connecting and manipulating the Epicor system. I use it mainly for creating\testing customization before dropping them into E10.
Generally I use this pattern:
using (epiSession = new Ice.Core.Session(user,pass, Ice.Core.Session.LicenseType.GlobalUser, @"E10LiveDB2.sysconfig"))
{
// Everything I want to do here
}
I am testing a more complex customization with some re-entrant stuff happening which is causing one hell of light show on the USER SESSIONS screen of the Administrative Console. My expectation was that since Session is an iDisposable, using would ensure it got cleaned up (and presumably disconnected) but that doesn’t seem to be the case when one using() enters another.
Once this project is moved into E10, it wont be an issue since I wont be spinning up sessions anyway but in the meantime, it’s driving me nuts.
My initial thought is to make a singleton class that will encompass the session, oTrans, etc and ensure only one instance. My confusion is that if I don’t use a USING statement, how do I disconnect a Session object? Just call dispose?
Dispose should do it, they used to have a Close method on it but I believe that’s now gone. I don’t do a lot of creting of sessions externally but as long as you are letting that use finish all the way then it should dispose of the session properly. Though they may still show up in Admin Console for a little bit
I think grey… don’t tell me those were inactive sessions…lol. If so, why even list them? I ended up multi-selecting and deleting them for good measure. Which means they were blue at least for a second haha
well damn, I guess that hour spent trying to rewrite my code to use a single session was time wasted. Good to know for future reference. Also, it looks like Dispose() calls this gem: