LINQ to SQL: Does it have much of a future?

Kevin Kline recently posted, wondering about the directions for LINQ.

When people refer to LINQ, they're often referring to "LINQ to SQL" instead.

LINQ as a language enhancement is pretty cool. It provides a way to easy navigate enumerable objects. The only thing that puzzles me is why they picked SQL-like syntax for this instead of something more appropriate for objects.

On the other hand, LINQ to SQL I can't get excited about. The main issues are that it's tied to SQL Server and only gives you a one-to-one mapping of tables to objects. That leaves you with either a lousy database design or a lousy object model.

The easiest example is anything that involves many to many relationships. If I have a flights table and a passengers table, I'd typically have a linking table (like flightmanifests) that records which passengers are on which flights. That's good database design but I wouldn't want an object model based directly on those three tables. What I'd want at the object level is a passenger object with a flights collection and a flight object with a passengers collection.

The Entity Framework lets you cope with both the issues mentioned and seems to be more likely to be the direction that Microsoft will keep heading. It also adds some interesting constructs in the ESQL language. However, its generic nature means you need to work with a very constrained set of data types. You lose the rich data types available with SQL Server in the trade off with the ability to write more generic code.

From the database end, LINQ to SQL can generate quite poor TSQL and the way people often use it ends up causing plan cache pollution issues, much the same as anyone using AddWithValue() to add parameters to a SqlParameters collection in ADO.NET would.

Every time I show people the TSQL code generated from some simple LINQ to SQL queries, I see two reactions. People with a developer background usually say "I'm glad I didn't have to write that". People with a database background say "No-one should write that – it's horrible code". And LINQ to Entities generates even more generic code (as you would imagine it needs to when it doesn't even know what database engine it's targeting).

This is usually all justified by increased developer productivity. "As long as it works well enough and it's done quickly, who cares if what's going on under the covers isn't great?" And that's 100% true for small or simple applications. However, the places I see Microsoft pushing this technology is to ISVs and large enterprise clients. These are likely to be the people it's least appropriate for.

The ADO.NET group seems to have adopted LINQ to SQL now but I know they really don't love it and the Entity Framework is what they're interested in. So I can't see LINQ to SQL having much of a future at all. LINQ to Entities is much more likely to stay around.

The other big issue I see in this area is maintenance. Microsoft have made big strides with the Database Edition of Visual Studio Team System but every time I ask questions about what the plans are for allowing it to "see" all the mapping files from these coding technologies, I get very blank stares back. Many DBAs can't make any changes to their databases today because they have a sea of Access applications all over the organisation and they don't know what will break when they change something. Are LINQ to SQL and Entity Framework mapping files going to be the next generation of Access-database-style management issues?

Rendering HTML in Reporting Services Text Boxes in SQL Server 2008

Some time back, I posted about how to do this. Well by the time we got to RTM, this had changed.

There isn't a "create placeholder" option when you right-click a cell any more.

When you drag a field into a cell, it creates a placeholder that contains the field. If you right-click the placeholder that was added, you'll see an option to edit the Placeholder Properties. What threw me for a while was that if you right-click the cell, you won't see this option. Turns out you have to right-click the field-name within the cell, not the blank area beside the name within the cell. Thanks to my colleague Jessica Moss for helping me find it.

This really isn't very good UI work in the report designer. It's quite counter-intuitive and different to how cell selection, etc. works in other products like Excel.

December Books Online for SQL Server

I'm always encouraging people to keep up to date with books online. There's another update out now.

I know when you get to this link:

http://www.microsoft.com/downloads/details.aspx?FamilyID=be6a2c5d-00df-4220-b133-29c1e0b6585f&DisplayLang=en 

it says "September" but it really is the one issued in December. (Of course when it's installed, it says November :-))

SQL Down Under show 42 – Ryan Dunn – SQL Data Services (SQL in the cloud)

I've recently posted up another podcast with Ryan Dunn. Ryan is a senior evangelist with Microsoft dealing with SQL in the cloud.

I keep running across people that suspect that this "cloud stuff" is some sort of fad. I doubt you'll think that after you listen to this show (and alsoshow 40).

It's now available for download from www.sqldownunder.com.

 

Iron DBA – New Zealand – 2008

Mai and I got back from New Zealand last night after attending the PASS Community Connection event in Porirua (near Wellington) in New Zealand.

It was a fun weekend as always and congratulations need to go to Nathan Pitcher (PASS Chapter leader from Dunedin) for organising it in conjunction with Adrian, Dave, Amanda, Sue and all the gang from the other local chapters as well as the staff of the local polytechnic where the event was held.

Adam Cogan and I got to present the keynote and decided to have a bit of fun by creating an "Iron DBA" competition, inspired obviously by Iron Chef television program from Japan. Chairman Cogan and Chairman Low then asked the audience a series of SQL Server questions (dispelling many common myths) until we had six Iron DBA finalists. Each was then allowed to nominate someone to help them prepare a submission on how SQL Server 2008 might help in a consulting scenario we had created. Nathan had organised a great trophy to go with the prizes. It'll now be an annual award.

All in all, it was a bunch of fun. Congratulations to the winner for 2008: David Philpott. (David is 3rd from the left, shown with the other finalists).

Ola Hallengren: SQL Server Backup, Integrity Check and Index Optimization

At the PASS Summit in Seattle this year, I had the pleasure of meeting Ola Hallengren. I've exchanged emails with him previously and I do want to highlight the tool he provides for SQL Server backup, integrity check and index optimization. You'll find details on it at:

http://ola.hallengren.com