views:

160

answers:

2

Is there a way to specify in a data connection or the LinqToSql Designer a schema?

Whenever I go to setup a data connection for LinqToSql there doesn't seem to be anyway to specify a schema and I get 'dbo' by default. I figure that I can't be the first person to use a schema other than 'dbo' with LinqToSql, so I must be missing something obvious.

EDIT: Maybe a little clarification is in order. Let's say that my database is such:

MyDatabase.dbo.Tables 
MyDatabase.MySchema.Tables

I can create a connection to MyDatabase.dbo (by default) and thus get a nice listing of tables that I can drag on to the designer.

What I can't seem to do is create a connection to MyDatabase.MySchema to get the nice table listings etc. of which I could drag on to the designer.

A: 

In the properties of each of the data classes inside the dbml the "Source" would usually point to dbo.TableName you should be able to change dbo to your schema name.

Edit:

If you are saying that your having to build the dataclasses manually... then with in the dbml designer you right click and say add, then select dataclass, then right click the new dataclass and select properties. Inside the property window of the dataclass there is a property call Source with is . it is at that point you would specify the schema name.

J.13.L
There is an attribute for each data class of [Table(Name="dbo.Queue")], but modifying this wouldn't help because I can't drag the tables from the schema I want in to the designer to have it generate the data class.
CAbbott
I guess this is the lesser of two evils. :) I just find it hard to believe that MS doesn't think that anyone would want access to a schema other than dbo.
CAbbott
I am not sure we are on the same page yet. I have 3 production applications that use SQL2005 and have schemas other than dbo (CAPS, CSI, SAMS, etc.) and in the LinqToSql dbml is has my schema and not dbo...
J.13.L
A: 

Try creating a user with a different default schema and setting that up in Server Explorer- it shows all the objects in the user's default schema (bonus- I saw all the dbo objects the user could see as well, with a (dbo) suffix).

nitzmahone
Thanks, but it's rather impractical to create a new user just to gain access to that schema.
CAbbott