LINQ standard query operators are the methods which help you to write LINQ query. Most of these query methods operate on sequences or collection whose implement the IEnumerable<T> interface or the IQueryable<T> interface. These operators provide query capabilities including filtering, projection, aggregation, sorting and much more.
LINQ Standard Query Operators Sets
LINQ provides two sets of standard query operators, one set operate on objects of type IEnumerable<T> and the other set operate.
Showing posts with label linq. Show all posts
Showing posts with label linq. Show all posts
Difference between ADO.NET and LINQ to SQL
As you know LINQ provides a common query syntax to query any data source and ADO.NET allows you to execute query against any RDBMS like SQL Server, Oracle etc. In this article, I am sharing my view on LINQ and ADO.NET.
ADO.NET
LINQ to SQL
It is a part of .NET Framework since .NET Framework 1.0
It is a part of .NET Framework since .NET Framework 3.5
SqlConnection/OleDbConnection is used for database connectivity.
We can use context for database connectivity.
Difficult to debug and cause syntax errors at run-time.
Easy.
LINQ Inner Join with AND and OR condition
LINQ has a JOIN query operator that provides SQL JOIN like behavior and syntax. As you know, Inner join returns only those records or rows that match or exists in both the tables. The simple inner join example is given below:
DataContext context = new DataContext();
var q = (from pd in context.Products
join od in context.Orders on pd.ProductID equals od.ProductID
orderby od.OrderID
select new
{
od.OrderID,
pd.ProductID,
pd.Name,
pd.UnitPrice,
od.Quantity,
od.Price,
}).ToList();
Inner Join with AND condition
Sometimes,.