Skip to main content

.NET Business Connector Reset

Eğer AX ile dış ortamlar arasında bir entegrasyon üzerinde çalışıyorsanız, AX tarafında değiştirdiğiniz kodların Business Connector (BC) tarafında yenilenmediğini ve hala eski şekli ile çalıştırıldığını görürsünüz. Bunun temel nedeni AOS’un kod performansını artırmak üzere kullandığı önbellek (cache) mekanizmasıdır. Canlı kullanımda olan bir projede normal olsa da, development esnasında oldukça sıkıntı veren bu durumu atlatmak için alttaki çözümü deneyebilirsiniz :
Bir web servisi yayınladıktan sonra her değişiklik yaptığınızda alttaki yolu izleyin:

1. Ax tarafında alttaki gibi bir job yazıp çalıştırın.
 
1static void FlushBC(Args _args)
2{
3 ;
4 xSession::removeAOC();
5 SysTreeNode::refreshAll();
6 SysFlushDictionary::doFlush();
7 xSession::updateAOC();
8}
2. IIS stop / start yapın.
3. BC’yi kullanarak AX nesnelerine eriştiğiniz metodlarda Garbage Collector’u çalıştırın.
 
01[WebMethod]
02public string testWS(string uid, string pwd, string _xml)
03{
04 using(Axapta ax = AX.AxLogon(uid, pwd))
05 {
06
07 try
08 {
09 if (ax != null)
10 {
11 object axObj = ax.CallStaticClassMethod("TestClass", "testMetod", _xml);
12 ax.Logoff();
13 return axObj.ToString();
14 }
15 else
16 {
17 return "0|İşlem Yapılmadı|Login Hatası";
18 }
19
20 }
21 catch (Exception e)
22 {
23 AX.WriteLog(e.ToString());
24 return "0|İşlem Yapılmadı|" + e.Message;
25 }
26 finally
27 {
28 ax.Logoff();
29 GC.Collect(); //Garbage Collector'u çalıştır
30 }
31 }
32}
Değerli katkılarından dolayı Alper Şamdancıoğlu ve Muammer Yiğit‘e teşekkürler.
Emre TÜFEKÇİ

Popular posts from this blog

Dynamics Axapta: Sales Orders & Business Connector

Well, again folllowing my same idea of writting close to nothing and pasting code, I'll paste in some code to create a sales order from some basic data and the invoice it. I'll try to explain more in the future. AxaptaObject axSalesTable = ax.CreateAxaptaObject("AxSalesTable"); AxaptaRecord rcInventDim = ax.CreateAxaptaRecord("InventDim"); AxaptaRecord rcCustTable = ax.CreateAxaptaRecord("CustTable"); rcCustTable.ExecuteStmt("select * from %1 where %1.AccountNum == '" + MySalesOrderObject.CustAccount + "'"); if (MySalesOrderObject.CurrencyCode.Trim().Length == 0) MySalesOrderObject.CurrencyCode = rcCustTable.get_Field("Currency").ToString().Trim(); string sTaxGroup = rcCustTable.get_Field("taxgroup").ToString().Trim(); //set header level fields axSalesTable.Call("parmSalesName", MySalesOrderObject.SalesName.Trim()); axSalesTable.Call("parmCustAccount", M

Passing values between form and class

Class name is EmplDuplication and Form is EmplTable . void clicked() {    MenuFunction mf;    args args = new Args();    ;     args.record(EmplTable);     mf = new menufunction(identifierstr(EmplDuplication), MenuItemType::Action); mf.run(args); } Meanwhile, in the main() method of the EmplDuplication class, we need to put this Axapta x++ code to get the datasource: static void main(Args args) {     EmplDuplication EmplDuplication; EmplTable localEmplTable; ;     if(args.record().TableId == tablenum(EmplTable)) localEmplTable = args.record();     ... }