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
source
share