Lambda Expressions In Entity Framework
From the two options I mentioned in my last post, I chose lambda expression for this post for those programmers who are not much comfortable with SQL like LINQ query. Microsoft gives us very good option called “Lambda Expression”. In this post I am going to demonstrate below operations: Simple select query using LINQ & Simple select query using lambda expression Select query with where condition using LINQ & select query with where condition using lambda expression Inner Join using LINQ & Inner Join using lambda expression Left Join using LINQ & Left Join using lambda expression Group by using LINQ & Group by using lambda expression Sorting using LINQ & Sorting using lambda expression Simple select: // Using LINQ Employee [] allEmployees1 = ( from E in NorthwindEntity.Employees select E).ToArray(); // Using lambda expression Employee [] allEmployees2 = NorthwindEntity.Employees.ToArray(); // Where condition using LINQ Employee [] allEmployees1 = ( from ...
Comments
Post a Comment