|
@@ -51,6 +51,7 @@ type
|
|
|
|
|
|
TOrderDirection = (odAscending, odDescending);
|
|
|
|
|
|
+ {$IFNDEF FPC}
|
|
|
TLinqExpression<T : class> = class(TExpression)
|
|
|
private
|
|
|
fPredicate : TPredicate<T>;
|
|
@@ -58,12 +59,15 @@ type
|
|
|
constructor Create(aPredicate : TPredicate<T>);
|
|
|
function Validate(aValue : TObject) : Boolean; override;
|
|
|
end;
|
|
|
+ {$ENDIF}
|
|
|
|
|
|
ILinqQuery<T> = interface
|
|
|
['{16B68C0B-EA38-488A-99D9-BAD1E8560E8E}']
|
|
|
function Where(const aWhereClause : string; aWhereValues : array of const) : ILinqQuery<T>; overload;
|
|
|
function Where(const aWhereClause: string): ILinqQuery<T>; overload;
|
|
|
+ {$IFNDEF FPC}
|
|
|
function Where(aPredicate : TPredicate<T>) : ILinqQuery<T>; overload;
|
|
|
+ {$ENDIF}
|
|
|
function OrderBy(const aFieldNames : string) : ILinqQuery<T>;
|
|
|
function OrderByDescending(const aFieldNames : string) : ILinqQuery<T>;
|
|
|
function SelectFirst : T;
|
|
@@ -99,7 +103,9 @@ type
|
|
|
destructor Destroy; override;
|
|
|
function Where(const aWhereClause : string; aWhereParams : array of const) : ILinqQuery<T>; overload;
|
|
|
function Where(const aWhereClause: string): ILinqQuery<T>; overload;
|
|
|
+ {$IFNDEF FPC}
|
|
|
function Where(aPredicate : TPredicate<T>) : ILinqQuery<T>; overload;
|
|
|
+ {$ENDIF}
|
|
|
function OrderBy(const aFieldNames : string) : ILinqQuery<T>;
|
|
|
function OrderByDescending(const aFieldNames : string) : ILinqQuery<T>;
|
|
|
function SelectFirst : T;
|
|
@@ -445,11 +451,13 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
+{$IFNDEF FPC}
|
|
|
function TLinqQuery<T>.Where(aPredicate: TPredicate<T>): ILinqQuery<T>;
|
|
|
begin
|
|
|
Result := Self;
|
|
|
fWhereClause := TLinqExpression<T>.Create(aPredicate);
|
|
|
end;
|
|
|
+{$ENDIF}
|
|
|
|
|
|
{ TLinq }
|
|
|
|
|
@@ -473,6 +481,7 @@ end;
|
|
|
|
|
|
{ TLinqExpression<T> }
|
|
|
|
|
|
+{$IFNDEF FPC}
|
|
|
constructor TLinqExpression<T>.Create(aPredicate: TPredicate<T>);
|
|
|
begin
|
|
|
fPredicate := aPredicate;
|
|
@@ -482,5 +491,6 @@ function TLinqExpression<T>.Validate(aValue : TObject) : Boolean;
|
|
|
begin
|
|
|
Result := fPredicate(aValue as T);
|
|
|
end;
|
|
|
+{$ENDIF}
|
|
|
|
|
|
end.
|