PostgreSQL Switching schemas based on user

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
npoulis@gmail.com
Posts: 2
Joined: Fri 13 Feb 2015 12:34

PostgreSQL Switching schemas based on user

Post by npoulis@gmail.com » Fri 13 Feb 2015 12:47

Hello all.

I got the following need.
I got 1 database with multiple schemas in the form

MyDB.schema_1
MyDB.schema_2
MyDB.schema_3

user1 is assigned to client1
user2 is assigned to client2
user3 is assigned to client3

All schemas above got the same exact table structure and relations (copy).

How can I enforce Entity Framework and Entity Developer to ignore the schema part in Model.edml

For example: schema_3

Code: Select all

<EntitySet Name="message_tags" EntityType="DataEntities.Store.message_tag" store:Type="Tables" Schema="schema_3" Table="message_tag" />
and switch schema prefix at runtime according to the user connected?

Shalex
Site Admin
Posts: 8240
Joined: Thu 14 Aug 2008 12:44

Re: PostgreSQL Switching schemas based on user

Post by Shalex » Mon 16 Feb 2015 14:49

npoulis@gmail.com wrote:How can I enforce Entity Framework and Entity Developer to ignore the schema part in Model.edml
Please open your *.edml model in Entity Developer (stanalone or integrated in Visual Studio), navigate to Tools > Entity Developer > Model Explorer > *.Store > Tables/Views, select all your tables and views, press F4 (properties) and clear the value in their Schema property.
npoulis@gmail.com wrote:and switch schema prefix at runtime according to the user connected?
Just change the connection string of your context.

npoulis@gmail.com
Posts: 2
Joined: Fri 13 Feb 2015 12:34

Re: PostgreSQL Switching schemas based on user

Post by npoulis@gmail.com » Mon 16 Feb 2015 16:08

Shalex wrote:
npoulis@gmail.com wrote:How can I enforce Entity Framework and Entity Developer to ignore the schema part in Model.edml
Please open your *.edml model in Entity Developer (stanalone or integrated in Visual Studio), navigate to Tools > Entity Developer > Model Explorer > *.Store > Tables/Views, select all your tables and views, press F4 (properties) and clear the value in their Schema property.
npoulis@gmail.com wrote:and switch schema prefix at runtime according to the user connected?
Just change the connection string of your context.
Hi,

Thanks for your answer, about the edml part of the question , I was actually asking if there is a way for it to be ignored by the Devart Entity library. That is because I have changed the connection string in the context -at runtime- to switch between schemas but it ignores it to the one defined in the edml.

Shalex
Site Admin
Posts: 8240
Joined: Thu 14 Aug 2008 12:44

Re: PostgreSQL Switching schemas based on user

Post by Shalex » Tue 17 Feb 2015 09:48

npoulis@gmail.com wrote:I was actually asking if there is a way for it to be ignored by the Devart Entity library
Yes, there is a such way with the IgnoreSchemaName option: http://www.devart.com/dotconnect/postgr ... tions.html. Does this help?

aKhan1
Posts: 2
Joined: Tue 22 Mar 2016 14:37

Re: PostgreSQL Switching schemas based on user

Post by aKhan1 » Tue 22 Mar 2016 17:05

I am using the Devart Version 4.5.901.0 and I cant find see the Schema or IgnoreDboSchemaName properties. Can you please direct me to which file do I need to look at or if I use the Entity developer, how to navigate to that property? Thanks

Shalex
Site Admin
Posts: 8240
Joined: Thu 14 Aug 2008 12:44

Re: PostgreSQL Switching schemas based on user

Post by Shalex » Wed 23 Mar 2016 17:35

aKhan1 wrote:I cant find see the Schema or IgnoreDboSchemaName properties. Can you please direct me to which file do I need to look at or if I use the Entity developer, how to navigate to that property?
These options are available in our Entity Framework implementation. About LinqConnect, we have answered you in this thread: http://forums.devart.com/viewtopic.php?t=33407.

Post Reply