In my app, which utilizes the AX .NET Business connector as I’m still in development I call the doFlush
method when I instantiate a new connection to AX like so, this just ensures that any new methods or updated methods I have created in AX are called and work as intended:
public AXConnector()
{
// 2713 port uses play
Axapta.LogonAs("myProxy", "myDomain", myNetworkCredentials, "myCompany", "en-gb", "myAXServer:2713", "");
// flush connector cache, for development only
Axapta.CallStaticClassMethod("SysFlushAOD", "doFlush");
}
This class implements IDisposable so I call the Axapta.LogOff()
method in the Dispose()
method like so:
public void Dispose()
{
Axapta.Logoff();
}
Then I wrap this around my other methods to AX by using a using
like so:
using(var ax = new AXConnector())
{
// my other AX code, CallStaticClassMethod etc...
}
Sometimes I noticed I was receiving an exception or my code wouldn’t work as intended, so I’ve wrapped it with a try/catch block and I get this error:
Error executing code: SysFlushAOD object does not have method 'doFlush'.
(C)\Classes\SysFlushAOD\doFlush
After looking at MSDN: http://msdn.microsoft.com/en-us/library/sysflushaod.doflush.aspx
I cant see what I’m doing wrong? The only way I’m able to fix this is by recycling the App Pool of this app on IIS.