Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write linq query to match SQL like select top 100 * from tab?

Tags:

linq

People also ask

How do you write a query in LINQ?

There are the following two ways to write LINQ queries using the Standard Query operators, in other words Select, From, Where, Orderby, Join, Groupby and many more. Using lambda expressions. Using SQL like query expressions.

How does a LINQ query transform to a SQL query?

LINQ to SQL translates the queries you write into equivalent SQL queries and sends them to the server for processing. More specifically, your application uses the LINQ to SQL API to request query execution. The LINQ to SQL provider then transforms the query into SQL text and delegates execution to the ADO provider.


EntityQuery<Employee> query = (from e in ctx.GetEmployeeQuery()  
                              orderby e.DateCreated descending
                              select e).Take (100);