Distinguish between EF query and LINQ query

I am new to Entity Framework. I am a little confused by the difference in the EF query and the LINQ query. I have two tables and related queries listed below. Could you tell me if all of these queries are LINQ or any of them in EF? I need to write EF queries to select an entire row, multiple columns, and also a join. Your help or any relevant links would be greatly appreciated.

Table Product_Details Product_ID, Product_Name, Price, Item_Desc, Stock_Avaialble, Created_Date

Sales_Details table Sales_ID, Product_ID, Qunatity, Total_Amont

var result = context.ProductDetails
                where ProductID == 10
                select new {ProductID, ProductName, Price}

var result = from prod in context.ProductDetails
                    where ProductID == 10
                    select new {ProductID, ProductName, Price}

var result = context.ProductDetails
                    .Where(p=>p.ProductID == 10)
                    .Select(p=> new Prod(p.ProductID, p.ProductName, p.Price))

var result1 = from prod in context.ProductDetails
                    join sales in context.SalesDetails on prod.ProductID == sales.ProductID
                    select new {prod.ProductID, prod.ProductName, sales.Qunatity, sales.TotalAmount}

Thanks Peter

+4
source share
3 answers

, E.F. , E.F., LINQ. LINQ, , .

E.F. :

Entity Framework - - (O/RM), .NET .NET. , .

Entity Framework - , #.

LINQ MSDN:

(LINQ), , .

LINQ #.

, .NET Framework, , XML-. .NET Language-Integrated Query (LINQ).

" ". E.F. , .

IEnumerable.

LINQ , LINQ "" ( DB), E.F..

+1

LINQ - (VB, #,.NET). EF. EF - , , LINQ . , EF . LINQ , .

+1

, , linq. , , db, (find, singleordefault, first, tolist ..). Linq , EF-, , . linq db EF ( ORM).

Some syntaxes, such as AsNoTracking (), Include (), ThenInclude (), etc., are exclusively EF syntax (which means you should refuse this library). Using linq syntax means you must refrence linq (although most templates include it by default).

0
source

Source: https://habr.com/ru/post/1686891/


All Articles