Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle Entity Framework - Generate Entity From Tables in Different Schema

Tags:

I log into Oracle using my own user account, which we can call my_account, and I am granted select privileges on all of the tables in the schema that our application uses, which I will call app_schema.

I would like to use Entity Manager to generate the entity definitions for the tables in the app_schema schema, but I do not have the password for that account and likely won't be given it, so I must log in as my_account.

When I run the wizard I can only see the tables in the my_account schema. Is there any way to get the tables from a different schema so that I can generate those? This is a massive database, so writing the .edmx file by hand could take days, and will probably result in tons of typo-induced errors. I have attempted to use synonyms, but they are not visible in the wizard either.

like image 469
Simon T Avatar asked Sep 14 '11 20:09

Simon T


Video Answer


2 Answers

In your Server explorer, select your connection and right. Click on filters tab, select Displayed schemas, then add more schemas from your schemas list. Remember click on update button and Ok to save changes on your connection.

Now when you add a new ADO.Net Entity Data Model you will see all tables from your schemas.

Please visit this link: https://forums.oracle.com/forums/thread.jspa?threadID=2291628&tstart=0

I hope help you with this.

Cesar.

like image 185
CMarchan Avatar answered Sep 23 '22 01:09

CMarchan


I am using EF 4.2 and found that I was able to use tables from another user/schema only when creating a new connection (using my_account) and using a filter when going through the Entity Data Model Wizard. Add app_schema to the Displayed Schemas filter (be sure to press Update).

Like CMarchan suggests, if I set the filter on the connection in the server explorer, it works for me there, but the EDM wizard does not see the connection when creating a new model (maybe just a "feature" in 4.2).

Once the EDM is created, it does allow me to add/edit tables from app_schema.

like image 36
Brian C Avatar answered Sep 26 '22 01:09

Brian C