Oracle 实体框架 - 从不同模式中的表生成实体

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7422275/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 00:19:07  来源:igfitidea点击:

Oracle Entity Framework - Generate Entity From Tables in Different Schema

c#oracleentity-framework

提问by Simon T

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

我使用自己的用户帐户登录 Oracle,我们可以将其称为my_account,并且我被授予对我们的应用程序使用的架构中的所有表的选择权限,我将其称为app_schema

I would like to use Entity Manager to generate the entity definitions for the tables in the app_schemaschema, 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.

我想使用实体管理器为app_schema模式中的表生成实体定义,但我没有该帐户的密码并且可能不会得到它,因此我必须以my_account身份登录。

When I run the wizard I can only see the tables in the my_accountschema. 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.

当我运行向导时,我只能看到my_account架构中的表。有什么方法可以从不同的模式中获取表,以便我可以生成这些表?这是一个庞大的数据库,因此手动编写 .edmx 文件可能需要数天时间,并且可能会导致大量拼写错误。我曾尝试使用同义词,但它们在向导中也不可见。

回答by CMarchan

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.

现在,当您添加新的 ADO.Net 实体数据模型时,您将看到架构中的所有表。

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

请访问此链接:https: //forums.oracle.com/forums/thread.jspa?threadID=2291628&tstart=0

I hope help you with this.

我希望能帮到你。

Cesar.

塞萨尔。

回答by Brian C

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_schemato the Displayed Schemas filter (be sure to press Update).

我正在使用 EF 4.2,发现只有在创建新连接(使用my_account)并在通过实体数据模型向导时使用过滤器时,我才能使用来自另一个用户/模式的表。将app_schema添加到 Displayed Schemas 过滤器(确保按更新)。

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

就像 CMarchan 建议的那样,如果我在服务器资源管理器中的连接上设置过滤器,它在那里对我有用,但是在创建新模型时 EDM 向导看不到连接(可能只是 4.2 中的“功能”)。

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

创建 EDM 后,它确实允许我从app_schema添加/编辑表。