15.12.2007, 01:11 | #1 |
Участник
|
axStart: use AX classes in your interface
Источник: http://axstart.spaces.live.com/Blog/...C0A0!174.entry
============== The power of AX classes. I have seen a lot of interfaces and they all have the same trouble or buck. Developers use insert() and update() methods without checking if there date is correct. We all know that insert() and update() from x++ code does not activate validatewrite() and validateField(). In Ax 3.0 developers always use the method validatewrite() first before doing the insert() or update(). However validatewrite() does not trigger validateField(). So most developers in Ax 3.0 added the validateField() lines to the validatewrite() method. (validateField checks if the value is also available in the parent table).This can result in performance issues. Now we have the AXDwizard. This wizard is normally used for AIF but can also help us to solve the validatefield trouble. The AXDwizard creates an AXClass that will act like a wrapper around your record that you want to create or insert. The option validateinput(true) will trigger the validateField() and validateWrite(). But be aware of next small points: · When I add a field to the table I also have to update the AXClass. Personal I like also to use these AXclasses when I access AX by the dotNet connector. Create example: X++: AXCustTable axct = AXCustTable::construct(); axct.parmAccountNum(); axct. validateInput (true); axct.save(); Update example: CustTable ct; TTSbegin; ct = CustTable::find(,true); AXCustTable axct = AXCustTable::construct(); Axct.cusTable(ct); axct.parmAccountNum(); axct. validateInput (true); axct.save(); TTSCommit; · Create an AOT query with only your table in it · Go to Tools\Development tools\Wizards\AXD wizards. · Select you’re query and compete the wizard · Throw the 2 methods with the compile error away. (Also the axdClass can be thrown away) Источник: http://axstart.spaces.live.com/Blog/...C0A0!174.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|