Hi!
I'm trying to create an edit form to allow users to insert new records in the DB. The forma has a TLookupcomboBox, a dataset for editing (adsEdit) and a dataset for a lookup (adsOwners).
I see the values in the lookup, but when I do adsEdit.Post, I get this error:
Cannot set value of property "OwnerId". Either property name is invalid or subproperty is inaccessible.
Entities:
[Entity]
[Table('Abonma')]
[Id('FId', TIdGenerator.IdentityOrSequence)]
TAbonma = class
private
[Column('Id', [TColumnProp.Required])]
FId: Integer;
[Column('ValidFrom', [TColumnProp.Required])]
FValidFrom: TDateTime;
[Column('ValidTo', [TColumnProp.Required])]
FValidTo: TDateTime;
[Association([TAssociationProp.Lazy], CascadeTypeAll - [TCascadeType.Remove])]
[JoinColumn('OwnerId', [], 'Id')]
FOwnerId: Proxy<TOwner>;
function GetOwnerId: TOwner;
procedure SetOwnerId(const Value: TOwner);
public
property Id: Integer read FId write FId;
property ValidFrom: TDateTime read FValidFrom write FValidFrom;
property ValidTo: TDateTime read FValidTo write FValidTo;
property OwnerId: TOwner read GetOwnerId write SetOwnerId;
end;
[Entity]
[Table('Owners')]
[Id('FId', TIdGenerator.IdentityOrSequence)]
TOwner = class
private
[Column('Id', [TColumnProp.Required])]
FId: Integer;
[Column('FirstName', [], 50)]
FFirstName: Nullable<string>;
[Column('LastName', [], 50)]
FLastName: Nullable<string>;
[Column('Active', [TColumnProp.Required])]
FActive: Integer;
public
property Id: Integer read FId write FId;
property FirstName: Nullable<string> read FFirstName write FFirstName;
property LastName: Nullable<string> read FLastName write FLastName;
property Active: Integer read FActive write FActive;
end;
edsEdit.SubPropsDepth = 1;
edsEdit.SyncSupProps = true;
edsEdit.CreateSelfField = true;
Since I don't know what extra info to attach, please let me know if you need additional informations.
Any tips..?