I want to test, if a given record exists already in the database. Is this the smartest way?
var
Rec: TTBLXLSImport;
Results: TObjectList<TCriteriaResult>;
begin
Results := mgrManager.Find<TTBLXLSImport>.Select(TProjections.Count('IDExtern').as_('anzahl'))
.Where(Linq['IDExtern'] = 12).ListValues;
if Results[0]['anzahl'] <> 0 then begin
// already here
Rec: TTBLXLSImport;
Results: TObjectList<TCriteriaResult>;
begin
Results := mgrManager.Find<TTBLXLSImport>.Select(TProjections.Count('IDExtern').as_('anzahl'))
.Where(Linq['IDExtern'] = 12).ListValues;
if Results[0]['anzahl'] <> 0 then begin
// already here
end else begin
// not here
end;
I assume, that
mgrManager.Find<TTBLXLSImport>.
.Where(Linq['IDExtern'] = 12).count
.Where(Linq['IDExtern'] = 12).count
is not possible?
Thank you!