Posts Tagged ‘LINQ’

Dynamic configurable and resuable Linq

How to get past of writing static linq statements? Or how to include the parameters in your linq query? Or write your linq dynamically in order for it to be configurable and reusable? Read the rest of this entry »


Limit Linq Outer Join Left To One Row

When we use DefaultIfEmpty we are doing an outer join, and if there is no match on right table, there will be null for the right table fields in joined big table, we are happy about this, but if sometime the right table has multiple matches for one left table entry, this will eventually multiply left table entries in the final big table, so we do not want this, if there are more matches in right table we want it to limit to one. Read the rest of this entry »


Linq Join On Multiple Fields

We all know we can do a linq join query like this

from c in Customers
join o in Orders on c.CustomerID equals o.CustomerID

If we have different companies and they all have their own customers, so we need to make join query based on two fields namely companyID and CustomerID Read the rest of this entry »


One Step Search Through XPath Query and Linq To Xml

As xml is main format of data exchange between systems, being comfortable of navigation of xml data is very important for xml handling. There are many ways a search can be performed on an xml document, but here I am trying to demo how to perform xml search using xpath query and linq to xml which in my view are two of the easiest and most clean way of handling complex xml data, the real scenario could be mix of both, I deliberately did this in order to show how each mechanism is working without each other and hoping that under some restrictive circumstances there is still one option left to use. Read the rest of this entry »

Tags: ,

How to do LINQ DateDiff in .NET 3.5

You would have thought that doing datetime comparison in LINQ is nothing particular. But it turns out to be tricky and little bit difficult especially in .Net 3.5. Read the rest of this entry »