Hello Wagner,
is it possible to cast a TXDataModel to TXDataAureliusModel?
I load the model like from an example
FXDataModel.Schemas.Clear;
LResponse := xClient.HttpClient.Get( xClient.Uri + '/$model');
try
if LResponse.StatusCode = 200 then
TXDataModelDeserializer.Deserialize( FXDataModel, TEncoding.UTF8.GetString( LResponse.ContentAsBytes))
else
TMessageDlg.Error( '$model kann nicht geladen werden.' + cStrCRLF +
'Url: ' + xClient.Uri + '/$model' + cStrCRLF +
'Code: ' + LResponse.StatusCode.ToString + cStrCRLF +
LResponse.StatusReason);
finally
LResponse.Free;
end;
I need a TXDataAureliusModel to use with the IXDataQueryBuilder
CreateQuery( model).From ...
works only if I call with a TXDataAureliusModel
See the sourcecode in XData.QueryBuilder
function TXDataQueryBuilder.From(const AClass: TClass): IXDataQueryBuilder;
var
TargetType: TXDataStructuredType;
begin
Result := Self;
TargetType := nil;
if FModel is TXDataAureliusModel then
begin
TargetType := TXDataAureliusModel(FModel).FindEntityTypeByClass(AClass);
if TargetType = nil then
TargetType := TXDataAureliusModel(FModel).FindInstanceTypeByClass(AClass);
end;
if TargetType = nil then
raise EXDataQueryBuilderException.CreateFmt(SInvalidQueryType, [AClass.ClassName]);
FBaseType := TargetType;
FTypedQuery := FModel is TXDataAureliusModel;
end;
Thank you,
Thomas