linq

TwitterFacebook
Get flash to fully experience Pearltrees
n-tier

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

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. This very little example shows that s1 and s2 are both accessible in the select. It’s nice, but how does this work ? You must know that the ‘from’ statement of the Linq sugar syntax does not match any existing Linq method. 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.
Check out the Dynamic Linq Library from ScottGu's blog: For example, below is a standard type-safe LINQ to SQL VB query that retrieves data from a Northwind database and displays it in a ASP.NET GridView control: Dim Northwind As New NorthwindDataContext http://stackoverflow.com/questions/30879/is-there-a-pattern-using-linq-to-dynamically-create-a-filter

Is there a pattern using Linq to dynamically create a filter? -

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 SearchProducts (params string[] keywords) { IQueryable 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. Checkout my virtual Florida Keys vacation slide show I built using a site I created that allows programmers to automate scripts for Google Street View using the programming language Forth.

Solid Code: Left Outer Join in LINQ

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