Two issues during the use of Entity Framework 6 Code First +mvc5+mysql/oracle

Source: Internet
Author: User

1.

namespacesnapsia.web.models{usingSystem; usingSystem.Data.Entity; usingSystem.ComponentModel.DataAnnotations.Schema; usingSystem.Linq; [Dbconfigurationtype (typeof(MySql.Data.Entity.MySqlEFConfiguration))] Public Partial classSnapsiacontext:dbcontext { PublicSnapsiacontext ():Base("Name=snapsiacontext")        {        }         Public VirtualDbset<influencersuser> Influencersuser {Get;Set; } protected Override voidonmodelcreating (Dbmodelbuilder modelBuilder) {}}}

2. The value of column "IsPrimaryKey" in Table "Tabledetails" is DBNull

Workaround:

Set Global optimizer_switch='derived_merge=off';

Http://stackoverflow.com/questions/33575109/mysql-entity-the-value-for-column-isprimarykey-in-table-tabledetails-is

http://bugs.mysql.com/bug.php?id=79163

Https://dev.mysql.com/doc/refman/5.7/en/switchable-optimizations.html

3.

[Table ("Tb_user", schema = "User_snapsia")]//dbo schema in Oracle database for user name Public Partial classTb_user {[Key] [Stringlength ( -)]         Public stringID {Get;Set; } [Stringlength ( -)]         Public stringUSERNAME {Get;Set; } [Stringlength ( -)]         Public stringPWD {Get;Set; } }
 Public Partial classOrclcontext:dbcontext { PublicOrclcontext ():Base("Name=orclcontext")        {        }         Public VirtualDbset<tb_user> Tb_user {Get;Set; }  Public VirtualDbset<tb_syys> Tb_syys {Get;Set; }  Public VirtualDbset<tb_cct> Tb_cct {Get;Set; } protected Override voidonmodelcreating (Dbmodelbuilder modelBuilder) { Modelbuilder.hasdefaultschema ( "User_snapsia"); DBO schema in Oracle database for user name modelbuilder.entity<TB_USER>()                . Property (e=e.id). Isunicode (false); }    }

Two issues during the use of Entity Framework 6 Code First +mvc5+mysql/oracle

Related Article

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.