I have created a component that is direct descendant from TAureliusDataSet.
I made this to override the 4 events introduced by TAureliusDataset:
OnCreateObject := NewCreateObject;
OnObjectInsert := NewObjectInsert;
OnObjectUpdate := NewObjectUpdate;
OnObjectRemove := NewObjectRemove;
Then for each one I use this:
procedure TNaharDataSet.NewObjectUpdate(Dataset: TDataSet; AObject: TObject);
begin
Model.SaveOrUpdate(AObject as TNaharEntity);
end;
and this Model is defined like this:
procedure TNaharModel.SaveOrUpdate(Entity: TObject);
begin
(Entity as TNaharEntity).Action(eaBeforeSave);
OManager.SaveOrUpdate(Entity);
ProcessUpdate(Entity as TNaharEntity);
end;
where the OManager is the TObjectManager.
For insert and remove everything works. The entity is created/deleted on the database.
Now the OnObjectUpdate that I use SaveOrUpdate from TObjectManager is not UPDATING the entity on the database.
I can change anything on the entity and nothing happens. The fields are showing on the form correctly.
I can add new records and it gets saved.
Tracking the execution, it is calling the TObjectManager.SaveorUpdate as expected.
For some reason, Aurelius is not persisting. This is the entity snip:
[Entity]
[Table('ORGUNIDADE')]
[Inheritance(TInheritanceStrategy.JoinedTables)]
[Id('ID', TIdGenerator.Guid)]
TEntityUnidadeOrg = class(TNaharEntity)
private
FId: TGuid;
public
[Column('ID', [TColumnProp.Unique, TColumnProp.Required, TColumnProp.NoUpdate])]
property Id: TGuid read FId write FId;
end;
What could be that is not triggering the Updating in Aurelius?
Thanks
Eduardo