Oracle Learning Schema under the 27th day EF

Source: Internet
Author: User

When the. NET background uses EF to connect to Oracle, if you do not explicitly specify the schema, you will get an error (the table is not found), which is examined below:

1, tracking Oracle backstage, EF FirstOrDefault, the conversion is ordinary select * from XX WHERE ROWNUM = 1; Copy can be executed but not recognized in EF because schema is not specified

2. You can change the entity table of EF to schema.table this form (not tried)

3, in front of the entity class with the schema, the project is generated through the stored procedure, I added a parameter, used to judge the word is Oracle to generate this form

[Table ("TableName", Schema = "SchemaName")]

4, if you want to dynamically generate schema, you can specify a generic schema in the Dbmodelbuilder, such as: Modelbuilder.hasdefaultschema ("SchemaName"), but only EF6 above can be used

5. EF6 below, specify for each table (can be recycled with reflection), such as:modelbuilder.entity<tablename> (). ToTable ("TableName", "SchemaName");

Oracle Learning Schema under the 27th day EF

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.