views:

207

answers:

2

I have just had to use LINQ to SQL on a SQL 2000 database and I have noticed that it does not include all the "Extensibility Method Definitions" actions, why is this?

A: 

According to Scott Guthrie:

LINQ to SQL will support SQL 2000. One feature that requires SQL 2005 is the server-side paging support (where you only do the paging in the database). This uses the SQL 2005 ROW_NUMBER() feature which is only in SQL 2005

Mitch Wheat
Okay, that sounds good, so where has the Extensibility Method Definitions gone?
Coppermill
+1  A: 

What exactly is missing? What are you seeing (or not)?

In particular, LINQ-to-SQL's strategy for the database (i.e. how to do paging etc on SQL2000 vs SQL2005 etc) is chosen at runtime based on the connection and the specific server (so it updates automatically when you install SQL Server 2008).

The code generation is based purely on the dbml, which doesn't really care about the server version (it is just xml - take a look).

If you are missing some partial methods, I wonder if you haven't accidentally detached your partial classes from the dbml-generated ones, perhaps by changing the namespace or their names.

Marc Gravell
I have the same table in two different database a SQL 2000 and SQL 2008, and here is the resulting generated code, you will notices that in the SQL 2000 version it is missing the Extensibility Method Definitions regionhttp://www.bryanavery.co.uk/file.axd?file=2009%2f8%2fDataClasses1.designer.csI have tried doing this on a smaller table and it appears to work okay, so what is wrong with this one?
Coppermill
Okay, found it my SQL 2000 table did not have a primary key, and as such the Extensibility Method Definitions was not created.After adding a Primary key the Extensibility Method Definitions come in.
Coppermill