Using a schema other than 'dbo' in LinqToSql Designer
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 MyDat开发者_StackOverflowabase.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.
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.
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).
精彩评论