Not Specifying the Schema Name

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Anchor
Posts: 31
Joined: Mon 08 Dec 2008 21:02
Location: Massachustts/USA

Not Specifying the Schema Name

Post by Anchor » Fri 15 May 2009 22:26

Hello,

Do you have to specify the schema name in the .edmx file or can you delete it or remove it?

We want to be able to remove any references to the schema so we can use database synonyms defined for a database login user/accout. These synonyms will specify what tables or views to look at/use in what schema.

Can I take, for example, a line like this in the .edmx.....



....and do something like this.....



...??

Thanks in advance for the help.

-- Joe

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 18 May 2009 10:47

You can safely remove the schema attribute from the model.

Anchor
Posts: 31
Joined: Mon 08 Dec 2008 21:02
Location: Massachustts/USA

Post by Anchor » Mon 18 May 2009 14:13

Do you mean I can remove it from the .edmx file or do I remove it from the generated .ssdl file? I just want to make sure I have a clear understanding.

Does this mean that once it is removed, the entity framework, or the database, will use the synonyms of the user to locate the table(s)?

Thanks,
Joe

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 18 May 2009 14:49

You can remove the schema attribute from the .edmx file.
This will make EF to use the synonyms.

Anchor
Posts: 31
Joined: Mon 08 Dec 2008 21:02
Location: Massachustts/USA

Post by Anchor » Mon 18 May 2009 15:47

Thank you for the quick responses!

One thing. Will this work with views as well? Can I just remove the schema name from in front of the view name?

Anchor
Posts: 31
Joined: Mon 08 Dec 2008 21:02
Location: Massachustts/USA

Post by Anchor » Mon 18 May 2009 17:18

For example, I have a view that is defined like this....


SELECT
V_529_COLUMN_COMMENTS.COLUMN_NAME AS COLUMN_NAME,
V_529_COLUMN_COMMENTS.COMMENTS AS COMMENTS,
V_529_COLUMN_COMMENTS.TABLE_NAME AS TABLE_NAME
FROM COMMON_OWNER.V_529_COLUMN_COMMENTS V_529_COLUMN_COMMENTS



...and now I have it defined like this....


SELECT
V_529_COLUMN_COMMENTS.COLUMN_NAME AS COLUMN_NAME,
V_529_COLUMN_COMMENTS.COMMENTS AS COMMENTS,
V_529_COLUMN_COMMENTS.TABLE_NAME AS TABLE_NAME
FROM V_529_COLUMN_COMMENTS V_529_COLUMN_COMMENTS


Is this correct?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 19 May 2009 06:31

Yes, this definition is correct.

Anchor
Posts: 31
Joined: Mon 08 Dec 2008 21:02
Location: Massachustts/USA

Post by Anchor » Tue 19 May 2009 19:01

I tried out these suggestions and they all worked out great! Thanks for the help!

mpovidlov
Posts: 20
Joined: Tue 06 Jan 2009 00:34
Location: US

Post by mpovidlov » Thu 21 May 2009 00:05

I have an "opposite" question. I use two database instances. Tables in both of them sometimes have the same name. I'd like to read from both instances in the same program, therefore I am trying to generate two ADO.NET Entitity Data models, one per each database connection.
As a result the generated classes are placed into the same namespace (named after my applicatoin name, WindowsFormsApplication1) and their methods clash because the tables and their columns have identical names.
What can I do to keep the generated classes in different namespaces. Should I just rename the namespaces in the model files or there is another more elegant solution?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 21 May 2009 08:00

For the .edmx files you should set the Custom Tool Namespace property to the name of namespace you wish
(Solution Explorer->right-click the model file->Properties).
For the .edml files you can simply set the Entity Namespace design time property of the model.

Post Reply