Coding Instinct: Querying across relations with LINQ using lambdas. Here is an interesting problem, try writing the bellow Linq query using lambda expressions. var usersWithBigOrders = from usr in context.Users from ordr in usr.Orders where ordr.Total > 10 select usr; I ran into this interesting Linq question when writing yesterday's post.
To figure out what the above query actually does I used Reflector. The code bellow is what the C# compiler will generate (when reverted back from IL to C#): It is quite surprising how much code that the compiler actually generates. So in order to understand what the above code actually describes I wrote the same Linq query but instead of querying LinqToSql I queried a normal .NET collection. This is a lot more understandable, but still it took a while to figure out exactly what the above code was doing. DryadLINQ. DryadLINQ is a simple, powerful, and elegant programming environment for writing large-scale data parallel applications running on large PC clusters. The goal of DryadLINQ is to make distributed computing on large compute cluster simple enough for every programmer.
DryadLINQ combines two important pieces of Microsoft technology: the Dryad distributed execution engine and the .NET Language Integrated Query (LINQ). Dryad provides reliable, distributed computing on thousands of servers for large-scale data parallel applications. LINQ enables developers to write and debug their applications in a SQL-like query language, relying on the entire .NET library and using Visual Studio. DryadLINQ translates LINQ programs into distributed Dryad computations: C# and LINQ data objects become distributed partitioned files.LINQ queries become distributed Dryad jobs.C# methods become code running on the vertices of a Dryad job. DryadLINQ has the following features:
101 LINQ Samples. Artikelen : .NET - LINQ to SQL - deel 1. After reading all articles on Scott Guthrie's blog and some Microsoft documents about LINQ to SQL, formerly known as DLINQ, I started experimenting with an object model of the Northwind database. Some of my examples can be useful for others so I decided to published them all in this article. Please make sure to read the blog of Scott Guthrie ( before starting with LINQ to SQL. All examples on this page are originally created with Visual Studio 2008 Beta 2 and .NET 3.5 'Orcas' release. In December 2008 this article has been updated because some names of methods and collections have been changed in Visual Studio 2008 RTM. In part 2, 3 and 4 I will cover following topics : Querying I really like querying with LINQ to SQL.
Top 10 of most ordered products The Take() operator yields a given number of elements and skips the remaining. This LINQ to SQL query will result in the following SQL statement : SELECT TOP 10 [t2]. SELECT [t0]. SELECT [t0]. SELECT [t0]. SELECT [t0]. LINQ: Building an IQueryable Provider - Part I - The Wayward WebLog. Public class Query<T> : IQueryable<T>, IQueryable, IEnumerable<T>, IEnumerable, IOrderedQueryable<T>, IOrderedQueryable { QueryProvider provider; Expression expression; public Query(QueryProvider provider) { if (provider == null) { throw new ArgumentNullException("provider"); this.provider = provider; this.expression = Expression.Constant(this); public Query(QueryProvider provider, Expression expression) { if (expression == null) { throw new ArgumentNullException("expression"); if (!
Throw new ArgumentOutOfRangeException("expression"); this.expression = expression; Expression IQueryable.Expression { get { return this.expression; } Type IQueryable.ElementType { get { return typeof(T); } IQueryProvider IQueryable.Provider { get { return this.provider; } public IEnumerator<T> GetEnumerator() { return ((IEnumerable<T>)this.provider.Execute(this.expression)).GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this.provider.Execute(this.expression)).GetEnumerator(); try { return null;
Coding Instinct: Querying across relations with LINQ using lambdas.