I have a problem with deserializer.
All fields are read except "DokTyp"
I have this JSON Input: (The "DokTyp" shows every test I made)
"Dokument": {
"AblageExtern" : true,
"Attribut": 4096,
"Check": 0,
"DokTyp": "{FF642ACD-6526-4ADE-A58E-A8B23D1BCD9F}",
"DokTyp": "FF642ACD-6526-4ADE-A58E-A8B23D1BCD9F",
"DokTyp@xdata.ref": "DokumentTyp(FF642ACD-6526-4ADE-A58E-A8B23D1BCD9F)",
"DokTyp@xdata.proxy": "DokumentTyp(FF642ACD-6526-4ADE-A58E-A8B23D1BCD9F)",
"DokTyp@xdata.proxy": "DokumentTyp(FF642ACD-6526-4ADE-A58E-A8B23D1BCD9F)/DoktypId",
"Art": "Beleg",
"Titel": "Titel"
},
This is the declaration (Entity)
TDokument = class(TsngEntity)
... ... ...
[Association([TAssociationProp.Lazy, TAssociationProp.Required], CascadeTypeAll - [TCascadeType.Remove])]
[JoinColumn('dokt_id', [TColumnProp.Required], 'dokt_id')]
FDokTyp: Proxy<TDokumentTyp>;
-------------------------------------------------------------
TDokumentTyp = class(TsngEntity)
private
[Column('dokt_id', [TColumnProp.Required])]
FDoktypId: TGuid;
And this is my deserializer:
class function TsngJson.Deserialize<T>(const ModelName: string;const Json: string): T;
var
Deserializer: TXDataJsonserverDeserializer;
begin
Deserializer := TXDataJsonserverDeserializer.Create( TXDataAureliusModel.Get( ModelName),nil);
try
Result := Deserializer.Read<T>(Json);
finally
Deserializer.Free;
end;
//Result := Deserialize(Json, TypeInfo(T)).AsType<T>;
end;
I call
LDokument := TsngJson.Deserialize<TDokument>( sngSM[ sngDok].Name, LJSONDokument.ToJSON);
The field "DokTyp" is nil. Where is the error?