Cancel a modified object

There is a functionality to cancel and rever to original values?

This can be usefull whan I start a transaction ad it's fail...

How can I revert to before start transaction values?

You can use Refresh method to revert objects to their state in database.

Oh yes it's true, but...
When in a single transaction I edit many object in same object manager it's a problem.
If I've a table linked with a foreign key to other with 1..N relation type and I edit this second with a code like this:


var
  LAddress: TCustomAddress;
  LCustomer: TCustomer;
begin
  LCustomer := DBMgr.Find<TCustomer>(CustomerID);
  DBConn.StartTransaction;
  try
    for LAddress in LCustomer.AddressList do
    begin
      LAddress.Street := 'NewValue';
    end;
    raise Exception.Create('This is an exception');
  except
    DBConn.Rollback;
    raise;
  end;
end;


I need to "Refresh" all Customer's Address :(
This is a very trival example but in a really production the rollback can restore many data.

It would be nice in Aurelius to have a functionality like FireDAC -> SavePoint that can help us to revert all edited objects to SavePoint state.

Sorry for my bad english.

If a manual SavePoint/RestorePoint is an option, then that's an interesting suggestion, indeed.

Oh yes if you can implement this...for me is very very good.

To bypass this problem I've created a simple TJSONValue field into store a serialized object and I want to restore this JSON when the user click cancel, but when I deserialize the TCustomer the address list is not restored.

It restore a TCustomJsonDeserializer.TJsonProxyController($13DB2A94) as IProxyController why...or what is the best way to do this?

Unloaded proxies are serialized with proxy info. It's described here:

http://www.tmssoftware.biz/business/aurelius/doc/web/index.html?lazy-loading_with_json.htm

Oh yes I see it again. But it's very complex to do a simple operation :(

I see this
JsonObject := DatasnapClient.RemoteProxyLoad(Serializer.ToJson(ProxyInfo));
but I don't use a datasnap client
I need to do this localy

you can implement any code you want to retrieve the proxy value. The example shows a request to DataSnap to retrieve the value, but you can just performa a Find operation in a TObjectManager to retrieve the object. 

Actually TObjectManager has a ProxyLoad method that receives a IProxyInfo directly and gives you the correct object.

Yes but I don't want to retrieve it with a Find I need this child to be restored from JSON and not reloaded from ObjectManager or database.

Haven't you just said you don't use DataSnap and want to retrieve it locally? Convert the JSON to IProxyInfo as showed in the example then call ProxyLoad instead of RemoteProxyLoad.

If you want to serialize it without the proxies you could try to load all proxies in advance, or do not use lazy loading in your mapping.