English 中文(简体)
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 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.

最佳回答

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).





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签