what I miss in LINQdatasource

ASP.NET SQLDatasource control was for me a super productive tool in the past. There are some small features missing like a more elegant data paging. ASP.NET 3.5 bring a new control LinqDatasource which have great support for data paging. So I tried  to create a rss feed with LINQtoSQL and LinqDatasource. Result is not as I expected.

Caching

SQLDatasource supports data Caching with simply two attributes enablecaching=true and cacheduration=60. Caching makes applications much faster.

Filtering

In combination with  caching SQLDatasource supports filterparameter which allow a kind of offline (from database) filtering. Also makes application faster and reduce load on SQL server.

FilterExpression="ProductName LIKE '@PN%'"

extended where conditions

As in the sample before i miss extended where condition in LINQ querys. The wizzard of LINQdatasource only allow a few expressions like ==.

In pure LINQ querys you can use syntax like

Dim expr = From hannes In kunden.Kundens _
                   Where hannes.City Like "a*" _
                    Select hannes

or even

 Where SqlMethods.Like(hannes.City, "a%") _

Both doesn’t work in LINQdatasource.

Relations

For this point i am not sure if I miss some part. With sqldatasource I usually join data via SQL command. With LINqtoSQL you can define relations but not to handle it virtual as one “table” . With LINQ query's in code that's not a issue. LINQDatasource only allows to select one table so i can not handle the join of normalized data.

 

I am open for discussion at this point.

Published Thursday, June 05, 2008 7:57 AM by preishuber
Filed under: , ,

Comments

# re: what I miss in LINQdatasource

Thursday, June 05, 2008 11:18 AM by rajbk

Hannes,

You can always handle the Selecting event of the LinqDataSource and setting the data object arg.Result available in the LinqDataSourceSelectEventArgs arg to whatever query you want.

In the example here, I am setting the data object to be a LINQ query that consumes an RSS feed.

weblogs.asp.net/.../using-the-listview-in-tiled-mode-part-2-css-layout.aspx

Raj

# re: what I miss in LINQdatasource

Thursday, August 14, 2008 10:16 PM by Ivan

Is there anyway to set the data with other LinqDataSource events rather than LinqDataSourceSelectEventArgs. If I decided to use the DataBind() method on a bound control it will not activate the OnSelecting Event for the LinqDataSource

# re: what I miss in LINQdatasource

Friday, August 15, 2008 3:29 AM by Ivan

Disregard Last Comment, I forgot to manually add databinding on my pager control, OnSelecting works fine.

# re: what I miss in LINQdatasource

Monday, May 14, 2012 2:42 PM by jBMFhTHvfKUutcK

mL83Om Thanks for sharing, this is a fantastic blog post.Really looking forward to read more. Really Great.

Leave a Comment

(required) 
(required) 
(optional)
(required)