Hellow
I'm starting to use EntityDAC and need to convert IentityEnumerable <T> to TObjectList <T>
Or somehow perform queries populating a TObjectList <T> and not an IentityEnumerable <T> as the examples show ...
var
FTest: IentityEnumerable <TTest>;
begin
FTest: = FContext.GetEntities <TTest>;
Can you help me?
Thank you for your attention.
How to convert IentityEnumerable<T> to TObjectList<T>
-
- Posts: 2
- Joined: Wed 06 Sep 2017 20:36
Re: How to convert IentityEnumerable<T> to TObjectList<T>
You cannot immediately convert IentityEnumerable <T> to TObjectList <T>. However, it's very simple to do it in your project code. The following snippet demonstrates such a possibility:
Code: Select all
...
var
i: integer;
EntityCollection: IEntityEnumerable;
List: TObjectList<TEntity>;
begin
List := TObjectList<TEntity>.Create;
try
for i := 0 to EntityCollection.Count - 1 do
List.Add(EntityCollection.Elements[i]);
...
finally
List.Free;
end;
end;