AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 30.12.2008, 11:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
C# and AX Development: WCF interface for Dynamics AX
Источник: http://olondono.blogspot.com/2008/12...namics-ax.html
==============

In DAX you must implement a lot of interfaces, some of them using ADO, AIF, WS, MSMQ, etc. I have developed my own interface using WCF (.NET Framework 3.5).

In this interface, I built two applications: the server that interacts with DAX by using the Business Connector and the client that is a standalone application that doesn't need ADSI and can run outside of the organization, for example, to send or receive data from partners automatically.



The example bellow includes the source code for Visual Studio 2008 and the DAX project (.xpo). In this project, I transport data from a local database (MyTable) to an owner table in DAX: WCFMyTable. Also, I can detect changes from any DAX table and send data to the client. For example: when any customer is added, I can replicate this data to legacy systems.



The DAX project includes the following elements:

WCFMyTable: this is a sample table for receive data from the client side.

WCFConnTest: this class is used to test the connection with DAX. The method getCustomer can be used for retrieve the first customer in the table CustTable.

WCFTask: is a class that encapsulates the access to any table we want to send to the client.

getRecord - returns a common record.
getRecordAxXml - returns the xml representation for the record this task is belong to.
MarkAsOK - update the task with a successful result when the client has processed it.
MarkAsFAILED - update the task as "failed" when the client has processed it and an error was raised. Tasks with errors are not removed from the table for debugging purposes.

WCFSender: this is the class that can be used for create a task for deliver to the client. You must override the update, insert and delete methods in the table you want to send. Here are the insert and update methods from the Dimensions table:

public void insert(){ super(); // Send this task WCFSender::SendThisRecord(this); // End}

public void update(){ DimensionSetCombination dimensionSetCombination; ; ttsbegin; if (this.Closed != this.orig().Closed) { update_recordset dimensionSetCombination setting active = !this.Closed where dimensionSetCombination.Dimension[Dimensions::code2ArrayIdx(this.DimensionCode)] == this.Num; } super(); ttscommit; // Send this task WCFSender::SendThisRecord(this); // End}

WCFTasks: this table store all tasks pending for deliver to the client. The table only store the reference to the record by tableId and recId.

WCFInterface: this is the main class that is used for read tasks from server (method getNextTask) and send data to server (method ProcessTask).

getNextTask: with this method we can get the next task for processing in the client side and at the same time, we can update the previous one. By using the Company and previousCompany parameters, we can read tasks from several companies.

ProcessTask: this is the method called when we want to send data back to DAX. We can also send multi-company data by specifying the Company parameter.

Here are the files for download:

Visual Studio 2008 project (AXInterface.zip)
The DAX project: WCFInterface.xpo
MyTable.sql definition



Источник: http://olondono.blogspot.com/2008/12...namics-ax.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
Старый 01.01.2009, 14:55   #2  
axstart is offline
axstart
MVP
Most Valuable Professional
NavAx Club
 
16 / 10 (1) +
Регистрация: 04.05.2008
Адрес: Holland
Why don't you use the AX classes that are generated with the AIF framework?
Your interface does not call for example validate write, so still corrupt data can be generated in AX
__________________
MVP
 


Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 03:09.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.