Once stuck on a requirement where I needed to write a code which is flexible and generic enough to sort any type of collection and also the property based on which it has to be sorted will be dynamic. After trying many options I discovered myself how easy it is to hit this requirement using Lamda Expression.
In this post I am going to show how to do ordering when you require to order data by using the multiple columns. By using .Orderby(x=>x.Columnname) in the LINQ query we can easily order data of the source collection. So most of new developer make use of the same function two time .Orderby(x=>x.Columnname).Orderby(x=>x.Columnname) and thinks that will do… Read More »
Few days ago I was working on my project which is having Linq to Sql as database layer. I got requirement to get the first of all employee who’s designation starts with “soft”. I get fired below query and got the result in IEnumerable varible But later on I found there it’s taking too much time to get… Read More »
In this post I am going to show two keyword of the C# 3.0 is very helpful when playing with the set of object collection using LINQ feature. Into Into keyword allows creating a temporary variable to store the results of a group, join or select clause into a new variable.
In this post I am going to discuss about building dynamic query with the LINQ. LINQ to SQL allow user to query data from the database without writing sql queries by writing LINQ queries. LINQ represent each table as one entity and where LINQ queries allows to manipulate data in type safe. But Static LINQ queries not able… Read More »
In this post I am going to discuss about Default extension method(s) which are use full when we query the data form the collection,array or performing operation while code using linq to sql. In .net framework there are number of extension methods which allows perform function on the the collection. But problem arise when we don’t know the… Read More »
In this tips I have discussed about how to get the difference between two table/ entity sets. As for example we want to get rows form table_A which are not exists in table_B. (When table_A primarykey is part of table_B foreignkey). Following is way to get the row(s) form table_A which are not part of table_B In Linq… Read More »
In this tips we are going show how you can filter your data by RowNumbers that you assigned to your record(s). So to filter data in SQL (SQL server-2005) we use RowNumber function and than we use = or BETWEEN to filer data. In above query as you can see ROW_NUMBER() function assign number to records and than… Read More »