EF operation MySQL

Source: Internet
Author: User

EF's codefrist operation MySQL is prepared in advance:

1. Install two packages: Mysql.data and MySql.Data.Entity, add 2 packages to the Package Manager in vs. (Note required VS2015, and EF6 support);

2. Install MySQL, and configure the roles and permissions, it is best to install NAVICAT premium for easy viewing and management.

Once you're ready, just change the original EF operation Sqlservce Base above:

1. Modify the configuration connector

<add name="defaultconnection" connectionstring="data source=.; Initial Catalog=xxoo; Uid=xxoo; Pwd=xxoo "providername="MySql.Data.MySqlClient "/>

Remember the type is MySql.Data.MySqlClient

2. Configure the data source type in context operations

/// <summary>    /// Data Set Configuration class     /// </summary>    [Dbconfigurationtype (typeof(mysqlefconfiguration))]      Public Sealed class Dbcontexthelper:dbcontext {}

EF operation MySQL

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.