Hi,
I have a new serializer problem.
The old code works.
Result := TJson.SerializeAs<TsngService>(LSvc);
Then I expand the entity with a association.
I get an error with the "DependenciesList"
Here is the new object (a little bit shorter than real)
[Entity]
[Table('t_sng_services')]
[Id('FServiceID', TIdGenerator.None)]
TsngService = class
private
[Column('svc_id', [TColumnProp.Required])]
FServiceID: TGuid;
[Column('svc_name', [TColumnProp.Required], 80)]
FName: string;
[Column('svc_caption', [TColumnProp.Required], 80)]
FCaption: string;
[ManyValuedAssociation([TAssociationProp.Lazy, TAssociationProp.Required], [TCascadeType.SaveUpdate, TCascadeType.Merge, TCascadeType.Remove], 'FServiceID')]
FDependenciesList: Proxy<TList<TsngDependencies>>;
function GetDependenciesList: TList<TsngDependencies>;
public
constructor Create;
destructor Destroy; override;
class function Dependencies(AList: Boolean = True): String;
property ServiceID: TGuid read FServiceID write FServiceID;
property Name: string read FName write FName;
property Caption: string read FCaption write FCaption;
property DependenciesList: TList<TsngDependencies> read GetDependenciesList;
end;
Ok, I take the TAureliusJsonSerializer.
Serializer := TAureliusJsonSerializer.Create( TMappingExplorer.Default);
try
Result := Serializer.WriteAs<TsngService>(LSvc);
finally
Serializer.Free;
end;
This works, but I have the "F"-Property Names in the JSON string.
{"FName":"abc",FCaption":"abc"} instead {"Name":"abc",Caption":"abc"}
The entities are made from the Datamodeler.
I think I have to change the placement of the [Column ...]
But do I have to do this for all of my entities?
Every time manually?
Thaks for help.
Thomas