Показать сообщение отдельно
Старый 06.12.2013, 00:14   #2  
ax_mct is offline
ax_mct
Banned
 
2,548 / 1091 (0) ++++++++
Регистрация: 10.10.2005
Адрес: Westlands
Есть неплохой разбор в статье
https://community.dynamics.com/ax/b/...c-locking.aspx

Но автор не все рассмотрел.

Вот мои комментарии к статье своим собратьям на мерседесах.
Цитата:
What normally I use in the most cases from version AX 4.0 and the author did not mention about that way.

while select myTable
{
ttsBegin;
myTable.selectForUpdate(true);
myTable.MyField = 'something';
myTable.update();
ttsCommit;
}

In versions 2.5 and 3.0 I even declared a second table buffer myTable_upd to select for update every record individually while the first buffer myTable was just for getting records and checking conditions.

I might be wrong but despite a fact many developers use that new and probably modern style (i.e. select for update before ttsbegin) I am still concern
1. That article did not highlight how SQL Server behaves if locks or exceptions happened. Normally in T-SQL (in which X++ are translated) we use BEGIN { TRAN | TRANSACTION } before to select for update.
2. I have never seen official examples of code (MSDN, MCT materials) including AX 2012 where that modern style is used.

Am I too old and not creative enough anymore?
В каком месте я неправ?