Server mode using LINQ? Let's wax rhapsodic.

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.


Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.