TEntityQuery syntax

Discussion of open issues, suggestions and bugs regarding EntityDAC
Post Reply
Posts: 28
Joined: Thu 02 Sep 2010 12:08

TEntityQuery syntax

Post by ketas » Tue 31 Mar 2020 20:14

i try to use entitydac and i would like to know if there are some info to Linq property of TEntityQuery
and how can i define fields for this query. In documentation there is information for LINQ syntax, but this is
not usable in this property. I found in this forum only one answer with something
like "from e in emp" , but i think that is not really enough. I would like to use components, not coding
queries in source code (only way used in demo). I used unidac with design of queries in design time
(Sql property of TUniQuery) and i would like use entitydac the same way. Thanks for answer. Vojslav

Devart Team
Posts: 1530
Joined: Mon 06 Jul 2015 11:34

Re: TEntityQuery syntax

Post by MaximG » Fri 03 Apr 2020 11:22

To run LINQ queries with the TEntityQuery component, use the property TEntityQuery.LINQ : h[url]ttps://www.devart.com/entitydac/docs/devart.en ... y.linq.htm[/url]
For example, the below query selects particular fields from Emp table and returns them in sorted order:

Code: Select all

EntityQuery.LINQ.Text := 'From E In Emp OrderBy(E.EName) Select(E.EName, E.Job, E.Dept.DName)';
Refer to the official documentation for more information about constructing LINQ queries: https://docs.microsoft.com/en-us/dotnet ... using-linq
Note that EntityDAC supports only basic LINQ queries. You can find respective examples in the EntityDemo project, which is distributed with EntityDAC.

Post Reply