Illustration update the objects in one transaction, for example

If you need to update multiple objects in one transaction (for example, to maintain referential integrity), you can use the standard mechanism business server.

For the formation of the transaction that uses the object returned by OnUpdate any business server:

  • Create\subtract objects to the transaction.
  • To make the necessary changes in all the objects for the transaction (for example, insert links or edit fields).
  • Add all transaction objects in the array returned by method elements.

Example

For example, there are two classes that reference each other mandatory connection. The challenge when creating object of class A to automatically create a class object and put In links to each other.

To begin, you must create a business server for class A and privaste it to update objects of this class.

In the method OnUpdate of class A, you would write the following code:

var a = UpdatedObject;
var b = new B();
a.Копия = b;
b.Копия = a;

return new DataObject[2] { a, b }; 

Now when you create an object type And will automatically generate the copy - an object of type V.