linq

TwitterFacebook
Get flash to fully experience Pearltrees
n-tier

Mitsu's blog : Linq: how to share parameters between lambda

Before going into Linq, here is again one of my pictures: Le Louvre by night, Paris When using Linq to objects, you will quickly feel the need to pass some parameters from a method to another but it’s not so easy because each Linq method is not calling the following one. In a Linq sequence, each method is using the result computed by the previous one. So, local contexts are not visible from one method to another. The compiler is using two technical different ways to let parameters go out of a method. As an example, let’s first see how the .SelectMany() method is working. http://blogs.msdn.com/b/mitsu/archive/2009/05/18/linq-how-to-share-parameters-between-lambda-expressions.aspx
http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx

Dynamic LINQ (Part 1: Using the LINQ Dynamic Query Library) - Sc

LINQ (language integrated query) is one of the new features provided with VS 2008 and .NET 3.5. LINQ makes the concept of querying data a first class programming concept in .NET, and enables you to efficiently express queries in your programming language of choice. One of the benefits of LINQ is that it enables you to write type-safe queries in VB and C#. This means you get compile-time checking of your LINQ queries, and full intellisense and refactoring support over your code: While writing type-safe queries is great for most scenarios, there are cases where you want the flexibility to dynamically construct queries on the fly. For example: you might want to provide business intelligence UI within your application that allows an end-user business analyst to use drop-downs to build and express their own custom queries/views on top of data.

C# 3.0 in a Nutshell - PredicateBuilder

http://www.albahari.com/nutshell/predicatebuilder.aspx Dynamically Composing Expression Predicates Suppose you want to write a LINQ to SQL or Entity Framework query that implements a keyword-style search. In other words, a query that returns rows whose description contains some or all of a given set of keywords. We can proceed as follows: IQueryable<Product> SearchProducts (params string[] keywords) { IQueryable<Product> query = dataContext.Products; foreach (string keyword in keywords) { string temp = keyword; query = query.Where (p => p.Description.Contains (temp)); } return query; }
I found out how to perform a left outer join using LINQ from Bilal Haidar's blog . My example shows how to perform a left join from Person to Person Address. LINQ Query

Solid Code: Left Outer Join in LINQ

http://solidcoding.blogspot.com/2007/12/left-outer-join-in-linq.html