Hi,
This has been most difficult part to me during my Aurelius usage.
I have Entity (basecustomer) which contains customerProducts (kktuote)
Objectmanager finds BaseCustomer entity from db, I assign it to aureliusdataset using aureliusdataset.SetSourceObject.
childs aureliusdataset is connected using Datasetfield.
I can see basecustomer data and manually inserted rows in childtable and I can edit them.
But If I insert new row to childtable using grid, no master record is associated to child record
I tried this with ZEN, and just to make sure, i tried also with MSSQL got same result.
sql generated is
INSERT INTO kktuote (
GUID, tuotenro, asiakas, nimi)
VALUES (
'{7720D812-E3E0-4600-93E8-2A047984CEA8}', 'tetst-prod', , 'testproductname')
I have read several post and made minor adjustment (added .required attirbute)
What's wrong here? Or do I Have to manually assign Customer value to childobject?
[ Entity, Automapping ]
[ Table( 'asiakas' ) ]
[ Id( 'Fid', TIdGenerator.IdentityOrSequence) ]
[ model('TEST')]
TBasecustomer = class
private
[ Column( 'asiakas', [ TColumnProp.Required] ) ]
Fid: Integer;
[ Column( 'nimi', [ ], 40 ) ]
Fname: nullable< string >;
[ ForeignJoinColumn( 'Asiakas', [ TColumnProp.Required ] , 'asiakas') ]
[ ManyValuedAssociation( [ TAssociationProp.Lazy, TAssociationProp.Required], CascadeTypeAllRemoveOrphan, 'FCustomer' ) ]
Fsecondhandproducts: proxy< TList< TKirppisTuote > >;
function GetKirppisTuotteet: TList< TKirppisTuote >;
public
constructor Create;
destructor Destroy; override;
property Id: Integer
Read Fid
Write Fid;
property name: nullable< string >
Read Fname
Write Fname;
property secondhandproducts: TList < TKirppisTuote >
read GetKirppisTuotteet;
end;
[ Entity, Automapping ]
[ id('Fguid', TIdGenerator.Guid )]
[ Table('kktuote') ]
[ model('TEST')]
TKirppisTuote = class
private
Fguid: tguid;
[Column('tuotenro', [], 18)]
Fproduct_id: nullable<string>;
[Association([TAssociationProp.Lazy, TAssociationProp.Required], CascadeTypeAllButRemove)]
[JoinColumn('asiakas', [TColumnProp.Required])]
Fcustomer: Proxy<TBaseCustomer>;
[Column('hinta')]
Fprice: nullable<double>;
[Column('nimi', [], 60)]
Fname: nullable<string>;
function Getcustomer: TBaseCustomer;
procedure Setcustomer(const Value: TBaseCustomer);
public
property guid: tguid Read Fguid Write Fguid;
property product_id: nullable<string> Read Fproduct_id Write Fproduct_id;
property price: nullable<double> Read Fprice Write Fprice;
property name: nullable<string> Read Fname Write Fname;
property customer: TBaseCustomer read Getcustomer write Setcustomer;
end;