When I run this code, I get "Elisterror : The list don't allow duplicates"
When the first object of type TChiamata is attached the primary key remain the same and this create the error when attach the second object (tchiamata)
I know that primarykey is incremented into database layer. Why this happens ? Doesn't attach method increment the key?
Any suggestions?
var
p : TContatto;
c,c1 : TChiamata;
begin
p := tcontatto.Create;
p.Cognome := 'Giorgio';
p.Nome := 'Bartolo';
p.Indirizzo := 'V.le J.F. Kennedy';
p.Numero_Civico := '87';
p.CAP := '70124';
p.Paese := 'Italia';
p.Numero := '3936620642';
c := TChiamata.Create;
c.Data := Now;
c.Ora := Time;
c.Durata := 10.2;
c.NumeroChiamato := '0805610257';
c1 := TChiamata.Create;
c1.Data := Now;
c1.Ora := Time;
c1.Durata := 10.2;
c1.NumeroChiamato := '0805610257';
mdati.EntityContext1.Attach(p);
mdati.EntityContext1.Attach(c);
mdati.EntityContext1.Attach(c1); // here the error is arised
p.Chiamate.Add(c);
p.Chiamate.Add(c1);
MDati.EntityContext1.Save(p);
MDati.EntityContext1.Save(c);
MDati.EntityContext1.Save(c1);
ELIStError on attach method
Re: ELIStError on attach method
To give you a detailed answer, we first need to look into code that exposes such behavior. Please send us using the contact form https://devart.com/company/contactform.html a small code sample demonstrating the behavior, including the scripts for creating database objects, and your model (*.enml).
Re: ELIStError on attach method
Hi, I only want to know , the right way to create a master entity with a detail collection and save it. And then get it back from the database with detail in one step.If it is possible. Thanks.
For example : new DEPT entity; new EMP1 entity , new EMP2 entity ...and so on, then DEPT.EMPS.ADD(EMP1); DEPT.EMPS.ADD(EMP2)...at last DEPT.save.
For example : new DEPT entity; new EMP1 entity , new EMP2 entity ...and so on, then DEPT.EMPS.ADD(EMP1); DEPT.EMPS.ADD(EMP2)...at last DEPT.save.
Re: ELIStError on attach method
As we mentioned earlier, to give you a detailed answer, we first need to look into code that exposes such behavior. Please send us using the contact form https://devart.com/company/contactform.html a small code sample demonstrating the behavior, including the scripts for creating database objects, and your model (*.enml).
Re: ELIStError on attach method
Hi,
have same error , any news? I am not able to run nothing with entitydac, use it somebody in production?
Vojslav
have same error , any news? I am not able to run nothing with entitydac, use it somebody in production?
Vojslav
Re: ELIStError on attach method
So far we haven't received the source code of a sample application where the issue could be reproduced and investigated.