Server mode using LINQ? Let's wax rhapsodic.

ctodx
01 April 2008

In all the excitement of releasing both DXperience v2008 vol1 and our VCL Subscription build 34 on the same day a week or so ago, you may have missed this rather stunning bit of news, so I thought I'd bring it to your attention again. SD Times also phoned me up to get the inside angle, so it must be fairly important.

Last year we launched our server mode technology for displaying data from large datasets (especially remote ones) in our grids. In pretty short order we added this "server mode" to our new ASPxGridView, our XtraGrid, and to the just-about-demoable-but-still-very-alpha version of our grid for WPF.

In true CTO-hand-waving terms, the technology uses our XPO (eXpress Persistent Objects) product hiding behind a "simple" interface to perform all intensive data crunching on the server and only displaying what can be shown on the client grid. So, you want the first page of records for the grid? Our server mode instructs XPO to create a SQL statement that will return just that information. You want to sort of a column? The server mode gets XPO to create a SQL statement with an ORDER BY and that returns a single page of records. Grouping? Ditto, but this time only one page of group headers are returned. And so on.

No longer did your grid in your UI have to download the whole dataset and then sort it, group it and filter it. No longer did your users have to wait that interminable period drummiong their fingers while all that data was transferred to your client program. No longer did you have to restrict those same users from displaying "all records".

All was good, except that some customers didn't want to use XPO. Perhaps they already had their own data layer, or were using a third-party ORM, or they wanted to use it with non-database data. Sure, we said, perhaps a little too optimistically, just write another implementation of our IListServer interface. Well, I can count on one hand the number of customers who went that route — it's just not what our customer base wanted to do. They have real business problems to solve and writing IListServer implementations doesn't advance that requirement.

So we've been asked numerous times to provide more implementations of IListServer. Well, just like our customers found out, it's a lot of work.

Finally Alex on our XPO team decided enough was enough. He wanted to play with LINQ and he wanted to solve this problem, so he merged the two goals together and produced a new IListServer implementation, one that used a LINQ provider to serve up the data. (By "LINQ provider", I mean an implementation of IQueryable<T>.)

It works in pretty much the same way as XPO, but instead of generating SQL statements the implementation generates LINQ queries and then invokes the LINQ provider to execute them and return the data as an enumerable list.

This is — to this CTO anyway — an absolutely brilliant solution to the problem. It's positively elegant. Have you got some data in SQL Server database that you want to display in a grid? Use either the original server mode with XPO or the LINQ to SQL. How about some data in XML form in our ASP.NET grid? Use the new LINQ provider support. Do you use LLBLGen Pro? Try out their new LINQ to LLBLGen Pro beta with our grids. Heck, I'm feeling the need to write my own IQueryable implementation over some old data or other just so I can show that data in one of our grids.

Suddenly, we've expanded our server mode technology over a much larger universe of data. Already there's a host of LINQ providers and they're being written all the time (there's a pretty exhaustive list on Charlie Calvert's Links to LINQ page).

Mehul has recorded a screencast on setting the new LINQ server mode with both our XtraGrid and ASPxGridView. I urge you to watch them and to consider how you could take advantage of Alex' last few months' work.

Brilliant!

5 comment(s)
Ben Hayat
Ben Hayat

I wasn't expecting it to be ready so early. It was a nice surprise. My current project is all being done with LINQ and I was hoping I could use DX ASPXGrid, and now I can.

Thank you for great products!

..Ben

1 April, 2008
Anonymous
Craig

This is good news. My company rejected DevExpress unfortunately for this very problem last year. As the project has yet to get going we may well get back in the DevExpress boat now.

1 April, 2008
Anonymous
Tom Leeson

Linq is great yes - I tested this on 100,000, 200,000 rows of customer data from the Northwind database -works fine - great stuff!

I also tested it on 1000,000 rows  - that was a bit too much - Loading was fine -paging on scroll - not bad 2-5 secs.

I tweaked the server and memory settings.

Sorting and groupig killed it on non indexed columns.

However by controlling features such as grouping and prevetning sorting on columns which werent index worked nicely.  Nice one DevX.

A Linq let down is its requirement for static dataclasses and Linq to SQL mapping to be present at runtime. You cannot currently do this on the fly.  Not even with Dynamic Data Classes.  A data class is a class that contains only data members. A  VS2008 microsoft linq extended class: System.Linq.Dynamic.DynamicExpression class defines the methods for dynamically creating data classes. But it doesnt offer a way to map to a database object within a datacontext.

This means the xtragrid servmode scenario is limited by the Linq technology to using well define and static code.

Anyone planning to deploy adhoc querying for users better Plan and think of the of possibility of creating and recompiling the Linq to SQL datacontext dataclasses  to suit any database schema -object changes to supoport those queries in terms of datacontext dataclasses.

Otherwise it is awesome!

2 April, 2008
John Hamilton_1
John Hamilton_1

I agree 100% with your post. I was excited to read that the 8.1 release was going to support a LINQ to SQL server mode support. One of the first things I tried after downloading the new release was put this feature to work on a app I was working on.

Wow, I don't think I have ever seen something go together so quick, and with so little code. Effecient filter/sort out of the box, with out writing one line of code! Throw together some custom LINQ to SQL update code, and poof you have your form done in no time.

Up until now I have avoided doing web devlopment preferring to create win forms stuff (your tools rock there as well). I think this one feature (along with your other asp.net tools) has finally pushed me over to the asp.net side.

I am excited to see what you guys end up doing with Silverlight. You current set of tools are the answer today, but in the next year maybe two Silverlight is going to change things in a big way. Im looking forward to the day you guys add "Silverlight Delivered" to the front page of your web site! Keep up the great work!

3 April, 2008
richard morris
richard morris

Had DX been building against the betas of LINQ late last year this new version of DXperience would most likely be breaking customer builds.  Had they been promising LINQ support before building it, they might still be talking about it and not shipping it.

Guys, IMO the timing of your delivery is spot on, keep up the good work.

4 April, 2008

Please login or register to post comments.