Skip to main content

Latest Articles: LINQ


Dynamically Composing Expression Predicates
Entry Date: May 2009 site: Albahari Rating:
keywords:LINQ; LINQ To SQL; LINQ To XML;
Article Description:

Of all the things that will drive you to manually constructing expression trees, the need for dynamic predicates is the most common in a typical business application. Fortunately, it’s possible to write a set of simple and reusable extension methods that radically simplify this task. This is the role of our PredicateBuilder class.

Comments:

How to build up dynamic queries on LINQ (same approach as the one used by LINQPAD). Interesting, but hard to follow / understand.

Click Here To Navigate to the Article

Dynamic LINQ (Part 1: Using the LINQ Dynamic Query Library)
Entry Date: May 2009 site: Weblogs ASP .net Rating:
keywords:LINQ; LINQ To SQL; LINQ To XML;
Article Description:

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.

Traditionally these types of dynamic query scenarios are often handled by concatenating strings together to construct dynamic SQL queries. Recently a few people have sent me mail asking how to handle these types of scenarios using LINQ. The below post describes how you can use a Dynamic Query Library provided by the LINQ team to dynamically construct LINQ queries.

Comments:

One of the limitation of LINQ technology was the lack of support for creating ad hoc queries.

Now with this library we get a lot of power, we can just let the clients decide which fields display, filter, or group and build in runtime the query adhoc without having to go for the SQL statement build by concatenating a bunch of strings.

Click Here To Navigate to the Article

How to create a Dynamic LINQ Query Programmatically
Entry Date: May 2009 site: BV Software Blog Rating:
keywords:LINQ; LINQ To SQL;
Article Description:

If you've been stuggling to create a dynamic LINQ query you're not alone. Thanks to some research, hard work and a smart co-worker I was able to implement some cool dynamic LINQ code in our help desk application.

Comments:

Quite interesting, how to add dynamic where filters to a LINQ query.

Click Here To Navigate to the Article

101 LINQ Samples
Entry Date: May 2009 site: MSDN Rating:
keywords:LINQ; LINQ To SQL; LINQ To XML;
Article Description:
101 LINQ Samples
Comments:

A nice "learn by sample" page, good as well tu remember the syntax of some of the LINQ operators.

Click Here To Navigate to the Article

ADO.NET Entity Framework: What. How. Why.
Entry Date: Oct 2008 site: Channel 9 Rating:
keywords:ADO .net; LINQ; VS 2008; Visual Studio 2008; ADO .net Framework;
Article Description:
What's an Entity Framework, you ask? Well, watch and learn all about this new ADO.NET development framework/paradigm. For the ADO developers out there, you'll be quite pleased with the architectural direction ADO has taken.
Comments:

A bit old but quite interesting Web Cast about ADO .net Entity Framework. Good to know the basics of this technology and what can we expect from it.

Just to get the basics concepts and advantages.

Click Here To Navigate to the Article

Using Annotations to Transform LINQ to XML Trees in an XSLT Style (Improved Approach)
Entry Date: Sep 2008 site: Blogs MSDN Rating:
keywords:XML; LINQ; XSL; XSD; .net framework 3.5; LINQ To XML;
Article Description:

You can use LINQ to XML to transform XML trees with the same level of power and expressability as with XSLT, and in many cases more than with XSLT.

Comments:

Interesting XSLT vs. LINQ To XML post

The thumb rule that I follow in my development is: Am I developing something for my own consume or for other Ms Chaps ? Go for LINQ To XML (easy and powerful), Do I have to integrate with no Ms third parties? Go for XSL, you will have something neutral to work with.

Click Here To Navigate to the Article

Introduction to LINQ - Simple XML Parsing
Entry Date: May 2008 site: paranoid ferret Rating:
keywords:XML; LINQ; C# 3.0; .net framework 3.5; LINQ To XML;
Article Description:
Every programmer has had to parse an XML file. If you're trying to tell me you haven't, then you're lying and you just don't remember it. You probably shouldn't even call yourself a programmer.
Comments:

Very basic LINQ To XML tutorial, good for starters / crashcourse

You will learn how to execute a simple select, retrieve data and dump it into a generic list

Click Here To Navigate to the Article

LINQ: OfType Query Operator
Entry Date: May 2008 site: Blogs MSDN Rating:
keywords:LINQ; VS 2008; .net framework 3.5; Visual Studio 2008; LINQ To SQL; LINQ To XML;
Article Description:
LINQ comes with the OfType query operator, through which we can filter the required object type from a heterogeneous array.
Comments:

Ready to reuse sample, nice and easy

TypeOf allows us to filter in a generic list and get a set just of a given type

Good material to learn LINQ by sample :-).

Click Here To Navigate to the Article

The asp:ListView control (Part 1 - Building a Product Listing Page with Clean CSS UI)
Entry Date: Dec 2007 site: Weblogs ASP .net Rating:
keywords:ASP .net; Java Script; LINQ; VS 2008; .net framework 3.5; Visual Studio 2008; LINQ To SQL;
Article Description:

One of the new controls in ASP.NET 3.5 that I think will be very popular is the control. The ListView control supports the data editing, insertion, deleting, paging and sorting semantics of higher-level controls like the GridView. But - unlike the GridView - it provides you with complete control over the html markup generated.

The ListView control, when combined with the new Web Designer and rich CSS support in VS 2008, enables you to build much cleaner HTML UI. Over the next few weeks I'll be putting together several blog posts that show off how you can use it.

Comments:

In ASP .net 2.0, when we wanted to display tabular data, or have a grid layout style we had two choices:

  • --> Use a GridView: Heavy approach, not straight forward to customize, and... you loose a lot of control on the HTML that is generated (lot of tr, td's, ...), not very fancy to inject javascript services inbetween (altough is possible).
  • --> Use a Repeater: You get full control of the HTML that is going to be generated, but.. you mix HTML UI logic with application logic (sphaguetti code), and you have to add boiler plate code for things like paging.

ASP .net 3.5 ships the ListView control, with this component you get full control of the layout/HTML to be generated, and if you define the aspect using CSS you will have a cleaner code implementation than using a Repeater (and you get things like paging for free :-)). Comparing with the GridView, it generates clean and lite HTML, AJAX and javascript friendly, but you will have to do some more coding to get it working like you want (it's worth the extra work).

This tutorial combines the power of Listview with the power of the new LINQ technology.

Click Here To Navigate to the Article

Caching the results from LinqDataSource
Entry Date: Dec 2007 site: Weblogs ASP .net Rating:
keywords:ASP .net; Performance; LINQ; Cache; .net framework 3.5;
Article Description:
I wanted to be able to cache the results of a query from the LinqDataSource that was used in multiple places on the page. I whipped up this little class to do the work of caching for me. The class, LinqCacheDataSource, handles the Selecting and Selected events. The Selected handler inserts the result of the query into cache. The Selecting handler gets the result from the cache. If it doesn't find the result, the query runs as normal. The caching will only work for selecting data. It works great for dropdowns and other fairly static data.
Comments:

LINQDataSource cannot be cached... ehhh ummm... well you can extend the functionallity in order to allow caching.

Quite interesting, it even handles different combinations for caching.

Click Here To Navigate to the Article

LinqDataSource vs ObjectDataSource vs SqlDataSource
Entry Date: Dec 2007 site: Weblogs ASP .net Rating:
keywords:LINQ; .net framework 3.5; LINQ To SQL;
Article Description:
With ASP.NET 3.5, a new data source control joins the company: the LinqDataSource control. How does it position itself in the grid of data source controls?
Comments:

Interesting post, until now we had: SqlDataSource and ObjectDataSource:

  • --> The first one better know as "the evil" or "only use it for RAD or Prototyping".
  • --> The second (ObjectDataSource one was the right choice for proper n-tier development (avoiding mixing UI and data access).

LINQDataSource is the new kid in town... is it good, is it bad...??? Well, it seems to be cleaner that using a SQLDataSource (you are using LINQ Language to extract data, by default it performs nice things like efficient paging...), but still mixes UI an Data Access, and you will have to perform some extra work if you want to do things like caching.

ObjectDataSource + LINQ To SQL seems to be a robust combination but you will have to do some boring plumbing, but if your application will last for years and will be used by a wide audience, it could be the best approach to take.

Click Here To Navigate to the Article

Page (1) Of 3 Next Articles >>