# Pomelo.EntityFrameworkCore.MySql **Repository Path**: fu_qi/Pomelo.EntityFrameworkCore.MySql ## Basic Information - **Project Name**: Pomelo.EntityFrameworkCore.MySql - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2020-10-22 - **Last Updated**: 2021-03-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Pomelo.EntityFrameworkCore.MySql [![Build Status](https://dev.azure.com/pomelo-efcore/Pomelo.EntityFrameworkCore.MySql/_apis/build/status/PomeloFoundation.Pomelo.EntityFrameworkCore.MySql?branchName=master)](https://dev.azure.com/pomelo-efcore/Pomelo.EntityFrameworkCore.MySql/_build/latest?definitionId=1&branchName=master) [![NuGet](https://img.shields.io/nuget/v/Pomelo.EntityFrameworkCore.MySql.svg?style=flat-square&label=nuget)](https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql/) [![Pomelo.EntityFrameworkCore.MySql package in pomelo-efcore-public feed in Azure Artifacts](https://feeds.dev.azure.com/pomelo-efcore/e81f0b59-aba4-4055-8e18-e3f1a565942e/_apis/public/Packaging/Feeds/5f202e7e-2c62-4fc1-a18c-4025a32eabc8/Packages/54935cc0-f38b-4ddb-86d6-c812a8c92988/Badge)](https://dev.azure.com/pomelo-efcore/Pomelo.EntityFrameworkCore.MySql/_packaging?_a=package&feed=5f202e7e-2c62-4fc1-a18c-4025a32eabc8&package=54935cc0-f38b-4ddb-86d6-c812a8c92988&preferRelease=false) [![Join the chat at https://gitter.im/PomeloFoundation/Home](https://badges.gitter.im/PomeloFoundation/Home.svg)](https://gitter.im/PomeloFoundation/Home?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) `Pomelo.EntityFrameworkCore.MySql` is the most popular Entity Framework Core provider for MySQL compatible databases. It supports EF Core 3.1 (and lower) and uses [MySqlConnector](https://mysqlconnector.net/) for its high-performance database server communication. ## Compatibility ### Dependencies The following versions of MySqlConnector, EF Core and .NET Standard are compatible with `Pomelo.EntityFrameworkCore.MySql`: Pomelo.EFCore.MySql | MySqlConnector | EF Core | .NET Standard | .NET Core | .NET Framework -- | -- | -- | -- | -- | -- [3.2.3](https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql/3.2.3) | 0.69.9+ (but < 1.0.0) | 3.1.x | 2.0 | 2.0+ | 4.6.1+ [3.0.1](https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql/3.0.1) | 0.61.0+ (but < 1.0.0) | 3.0.x | 2.1 | 3.0+ | N/A [2.2.6](https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql/2.2.6) | 0.59.2+ (but < 1.0.0) | 2.2.6 | 2.0 | 2.0+ | 4.6.1+ ### Packages * [Pomelo.EntityFrameworkCore.MySql](https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql/) * [Pomelo.EntityFrameworkCore.MySql.Json.Microsoft](https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql.Json.Microsoft/) * [Pomelo.EntityFrameworkCore.MySql.Json.Newtonsoft](https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql.Json.Newtonsoft/) * [Pomelo.EntityFrameworkCore.MySql.NetTopologySuite](https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql.NetTopologySuite/) ### Supported Databases and Versions `Pomelo.EntityFrameworkCore.MySql` is tested at least against the latest 2 minor versions of `MySQL` and `MariaDB`. Older versions and other server implementations _may_ be compatible (and likely are to a high degree) but are not officially supported or tested. Currently supported versions are: - MySQL 8.0 - MySQL 5.7 - MariaDB 10.5 - MariaDB 10.4 - MariaDB 10.3 ## Schedule and Roadmap Milestone | Status | Release Date ----------|--------|------------- 5.0.0 | In Development | TBA 3.2.3 | Released | 2020-10-13 3.2.2 | Released | 2020-09-30 3.2.1 | Released | 2020-09-22 3.2.0 | Released | 2020-09-15 3.1.2 | Released | 2020-07-22 3.1.1 | Released | 2020-01-15 3.1.0 | Released | 2019-12-16 3.0.1 | Released | 2019-12-04 3.0.0 | Released | 2019-11-18 2.2.6 | Released | 2019-10-15 2.2.0 | Released | 2019-02-07 2.1.4 | Released | 2018-11-29 ## Nightly Builds To use nightly builds from our Azure DevOps feed, add a `NuGet.config` file to your solution root with the following content: ```xml ``` ## Getting Started ### 1. Recommended Character Set We recommend to set `utf8mb4` as your MySQL database default character set. This is already the server default in MySQL 8. The following statement will check the charset of the current database: ```sql show variables like 'character_set_database'; ``` ### 2. Project Configuration Ensure that your `.csproj` file contains the following reference: ```xml ``` ### 3. Services Configuration Add `Pomelo.EntityFrameworkCore.MySql` to the services configuration in your the `Startup.cs` file. ```csharp using System; using Microsoft.EntityFrameworkCore; using Pomelo.EntityFrameworkCore.MySql.Infrastructure; // Replace "YourNamespace" with the namespace of your application. namespace YourNamespace { public class Startup { public void ConfigureServices(IServiceCollection services) { // Replace "YourDbContext" with the name of your own DbContext derived class. services.AddDbContextPool( dbContextOptions => dbContextOptions .UseMySql( // Replace with your connection string. "server=localhost;user=root;password=1234;database=ef", // Replace with your server version and type. mySqlOptions => mySqlOptions .ServerVersion(new Version(8, 0, 21), ServerType.MySql) .CharSetBehavior(CharSetBehavior.NeverAppend)) // Everything from this point on is optional but helps with debugging. .UseLoggerFactory( LoggerFactory.Create( logging => logging .AddConsole() .AddFilter(level => level >= LogLevel.Information))) .EnableSensitiveDataLogging() .EnableDetailedErrors(); )); } } } ``` View our [Configuration Options Wiki Page](https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/wiki/Configuration-Options) for a list of common options. ### 4. Sample Application Check out our [Integration Tests](https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/tree/master/test/EFCore.MySql.IntegrationTests) for an example repository that includes a MVC Application. ### 5. Read the EF Core Documentation Refer to Microsoft's [EF Core Documentation](https://docs.microsoft.com/en-us/ef/core/) for detailed instructions and examples on using EF Core. ## Scaffolding / Reverse Engineering Use the EF Core tool to execute scaffolding commands: ``` dotnet ef dbcontext scaffold "Server=localhost;Database=ef;User=root;Password=123456;TreatTinyAsBoolean=true;" "Pomelo.EntityFrameworkCore.MySql" ``` ## Contribute One of the easiest ways to contribute is to report issues and participate in discussions. You can also contribute by submitting pull requests with code changes and supporting tests. We are always looking for additional core contributors. If you got a couple of hours a week and know your way around EF Core and MySQL, give us a nudge. ## License [MIT](https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/blob/master/LICENSE)