#1 2017-07-28 07:35:53

GLM
Member
Registered: 2014-01-22
Posts: 14

RTTI and TSQLRowBlob Type, trouble setting value

Hello,

I've trouble with the TSQLRawBlob type.
When I try to Transfert Data from a generic object to my agregat, using RTTI function to make it work in all case, it didn't succed with property of this type whereas it's ok when the same proprerty is RawUTF8.

Here is the part of code where I lose my value.

function TCommonDataTransfertObject.SetBasicProperty(aProp: TRttiProperty;
  aValue: Variant; aSourceAsPointer: Pointer;
  aPropertyType: System.TTypeKind): Boolean;
begin
  Result := False;
  try
    case aPropertyType of

      // ...

      System.tkUString, System.tkString, System.tkWChar, System.tkWString,
      System.tkChar, System.tkLString:
        begin
          if not VarIsNull(aValue) then
            aProp.SetValue(aSourceAsPointer, VarToStr(aValue))
          else aProp.SetValue(aSourceAsPointer, '');
        end;
      end;
     
    Result := True;
  except
    Result := False;
  end;

end;

Any idea ?

Regards

Offline

#2 2017-07-28 08:05:55

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: RTTI and TSQLRowBlob Type, trouble setting value

Don't reinvent the wheel and give a try to mORMotDDD.pas.

Online

#3 2017-07-28 08:38:05

GLM
Member
Registered: 2014-01-22
Posts: 14

Re: RTTI and TSQLRowBlob Type, trouble setting value

Argh ....

Well, I'm agree with you.
I'm trying to be DDD.
That's why I have an Agregat with my Domain, anda DataTransfertObject.

And I need to translate one to the other

Offline

#4 2017-07-28 09:48:30

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: RTTI and TSQLRowBlob Type, trouble setting value

Online

Board footer

Powered by FluxBB