#1 2019-07-01 14:11:25

Shadownildo
Member
From: Brazil
Registered: 2018-10-10
Posts: 36

SQLRecord Variant property Loading to Object

Hi there, Probabily this is a Dumb question and it's not a huge problem but i don't like the way i implement, i found some solutions, but i didn't like it so much, so i'm gonna ask,

there is a Way i can parse property Variants without have to create Local Vars to them ?

  procedure RecToORM(const rec: TSQLRecordSale;out ORM: TSale);
  var
  temp : Variant;
  EmployeeRef : TEmployeeRef;
  CompanyRef: TCompanyRef;
  begin
    with ORM do
    begin
.....
      temp := rec.Company; <-- Have to Assign to a Local Variant
      ObjectLoadVariant(CompanyRef, temp); <-- Then Load a the Variant to a local var object
      Company.EIN := CompanyRef.EIN ; <-- Then i really assign to the Main object
      temp:= rec.Employee;
      ObjectLoadVariant(EmployeeRef, temp);
      Employee.Name := EmployeeRef.Name;
    

// I was thinking if there is a way to do something like
// ObjectLoadVariant(Company,Rec.Company);
// in a Single Line, but the Method don't accept.
// I find out that have some ICQRS Methods that do this, but i don't really want to change the Architecture to use them, but if it's the way, so be it. Any Suggestion?
......
    end;
  end;

Offline

Board footer

Powered by FluxBB