#1 2020-03-30 17:06:15

larand54
Member
Registered: 2018-12-25
Posts: 51

Inheritance and persistance don’t work as I expected

I tested using the dddUserTypes unit with the classes TPersonFullName, TPerson and TPersonContactable.
Instead of Tuser I created the TCustomer class that inherits from TsynAutoCreateFields and contains a field of type TPersonContactable.

  TCustomer = class(TSynAutoCreateFields)
  private
    fContact: TPersonContactable;
  published
    property Contact: TPersonContactable read fContact;
  end;

Calling –
TDDDRepositoryRestFactory.ComputeSQLRecord([TPersonContactable, TCustomer]);
creates the following classes:
•    TSQLRecordPerson
•    TSQLRecordPersonContactable
•    TSQLRecordCustomer

Calling - .CreateMissingTables creates the following tables:
•    PersonContactable
•    Customer
PersonContactable contains all the fields from TAddress, TPerson and TPersonFullName and it’s own.
Regression tests on TCustomer confirm access to all fields of these classes.
But testing using ORM doesn’t give access to the fields in the class TPersonFullName. There is no error or warnings when adding records But the fields Name_First, Name_Middle, and Name_Last will not be updated in the table  “PersonContactable” but all other fields are updated.
I’ve checked all I can think of but can not make this work. Strange that ORM creates the fields from TPerson-TPersonFullName but does not allow access to the fields from TPersonFullName.
I wonder what I may be missing, I’m sure this should work automatically if I did everything wright.
Hope anyone could spread some light over this.


Lazarus-2.1.0, FPC-3.3.1, XE-6, Delphi-10.3, WIN10

Offline

Board footer

Powered by FluxBB