Hi,
I try reproduce steps in this article
http://goo.gl/v3vtyb I can publish multi-tier application successfully, and can see json result in browser.
But in Delphi Client, I can't use AureliusDataSet to list how you show in article.
DatasetIncidentes.Close;
Incidentes := ClientModule1.ListaIncidentesProjeto(IdProjetoSelecionado);
DatasetIncidentes.SetSourceList(Incidentes);
DatasetIncidentes.Open;
The variable "Incidentes", is what kind?
Best Regards
wlandgraf
(Wagner Landgraf)
April 26, 2016, 6:57pm
2
Variable "Incidentes" is TList<TIncidente>.
Don't works. My code above:
[SERVER Application]
function TParametrosController.GetAll: TJsonValue;
var
Lista: TList<TParametros>;
begin
Lista := FManager.Find<TParametros>.List;
try
Result := ToJson(Lista);
finally
Lista.Free;
end;
end;
function TParametrosController.ToJson(Obj: TObject): TJsonValue;
begin
Result := FSerializer.ToJson(Obj);
end;
In Client Application I use Datasnap wizard with ?DataSnap REST Client Module?, and try reproduce your sample in article and your answer in this post:
procedure TFrmMain.Button1Click(Sender: TObject);
var
Parametros: TList<TParametros>;
begin
Parametros := CM.ParametrosControllerClient.GetAll;
ads.Close;
ads.SetSourceList(Parametros);
ads.Open;
end;
This error it happens:
[dcc32 Error] uFrmMain.pas(37): E2010 Incompatible types: 'System.Generics.Collections.TList<Union.Models.TParametros>' and 'TJSONValue'
You have full code used in this article?
Best Regards
wlandgraf
(Wagner Landgraf)
April 27, 2016, 12:03am
4
Ah in this case Incidentes is being returned as a TJSonValue, you need to convert the TJSONValue to the TList<TIncidente> using a code similar to the one described in the FromJson method.
Please note that this article is relatively old and currently it's way easier to create a multi-tier application with Aurelius using TMS XData instead of DataSnap (at the time of this article was written TMS XData was not released yet).