Merge branch 'sempare_adaptor_support' of https://github.com/darnocian/delphimvcframework into darnocian-sempare_adaptor_support

This commit is contained in:
Daniele Teti 2024-01-02 16:22:50 +01:00
commit 86b82cf2c0

View File

@ -106,13 +106,19 @@ begin
LViewEngine := AObj.AsType<TMVCBaseViewEngine>; LViewEngine := AObj.AsType<TMVCBaseViewEngine>;
LKey := AsString(ADeref, AContext); LKey := AsString(ADeref, AContext);
// check if the key exists in the ViewModel // check if the key exists in the ViewModel
AFound := LViewEngine.ViewModel.TryGetValue(LKey, result); if assigned(LViewEngine.ViewModel) then
if AFound then begin
exit; AFound := LViewEngine.ViewModel.TryGetValue(LKey, result);
if AFound then
exit;
end;
// check if we have a dataset // check if we have a dataset
AFound := LViewEngine.ViewDataSets.TryGetValue(LKey, LDataSet); if assigned(LViewEngine.ViewDataSets) then
if AFound then begin
exit(LDataSet); AFound := LViewEngine.ViewDataSets.TryGetValue(LKey, LDataSet);
if AFound then
exit(LDataSet);
end;
// we don't know anything about the key, so behave accordingly // we don't know anything about the key, so behave accordingly
if ARaiseIfMissing then if ARaiseIfMissing then
RaiseError(APosition, SCannotDereferenceValueOnObject, [LKey, SDictionary]); RaiseError(APosition, SCannotDereferenceValueOnObject, [LKey, SDictionary]);