Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
10 contributors

Users who have contributed to this file

@yukozh @caleblloyd @lauxjpn @wiredbarb @antonioortizpola @rafaelblink @pedro-pedrosa @nagstaku @serhioV @Ciwan1859
129 lines (91 sloc) 5.82 KB

Pomelo.EntityFrameworkCore.MySql

Build Status NuGet Pomelo.EntityFrameworkCore.MySql package in pomelo-efcore-public feed in Azure Artifacts Join the chat at https://gitter.im/PomeloFoundation/Home

Pomelo.EntityFrameworkCore.MySql is an Entity Framework Core provider built on top of MySqlConnector that enables the use of the Entity Framework Core ORM with MySQL.

Compatibility

EF Core and .NET Core

The following versions of EF Core and .NET Standard are compatible with Pomelo.EntityFrameworkCore.MySql:

Pomelo.EntityFrameworkCore.MySql EF Core .NET Standard .NET Core .NET Framework
3.1.0-rc1 3.1.0 2.0 2.0+ 4.7.2+
3.0.1 3.0.1 2.1 3.0+ N/A
2.2.6 2.2.6 2.0 2.0+ 4.7.2+

Supported DBMS and Versions

Pomelo.EntityFrameworkCore.MySql is tested against the latest 2 minor versions of MySQL and MariaDB. Older versions may be compatible but are not officially supported or tested. Currently supported versions are:

  • MySQL 8.0
  • MySQL 5.7
  • MariaDB 10.4
  • MariaDB 10.3

Schedule and Roadmap

Milestone Status Release Date
3.1.0-rc1 Released 2019-12-06
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 in your solution root with the following contents:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="Pomelo" value="https://pkgs.dev.azure.com/pomelo-efcore/Pomelo.EntityFrameworkCore.MySql/_packaging/pomelo-efcore-public/nuget/v3/index.json" />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>

Getting Started

1. Recommended Server CharSet

We recommend to set utf8mb4 as your MySQL database default charset. This is the default in MySQL 8. The following statement will check your current DB charset:

show variables like 'character_set_database';

2. CSPROJ Configuration

Ensure that your .csproj file contains the following reference:

<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.0.1" />

3. Services Configuration

Add Pomelo.EntityFrameworkCore.MySql to the services configuration in your the Startup.cs file.

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)
        {
            // other service configurations go here
            // replace "YourDbContext" with the class name of your DbContext
            services.AddDbContextPool<YourDbContext>(options => options
                // replace with your connection string
                .UseMySql("Server=localhost;Database=ef;User=root;Password=1234;", mySqlOptions => mySqlOptions
                    // replace with your Server Version and Type
                    .ServerVersion(new ServerVersion(new Version(8, 0, 18), ServerType.MySql))
            ));
        }
    }
}

View our Configuration Options Wiki Page for a complete list of supported options.

4. Sample Application

Check out our Integration Tests for an example repository that includes a MVC Application.

5. Read the EF Core Documentation

Refer to Microsoft's EF Core Documentation 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 on issues. You can also contribute by submitting pull requests with code changes and supporting tests.

Pomelo.EntityFrameworkCore.MySql is always looking for additional core contributors. If you got a couple of hours a week and know your way around EF Core, give us a nudge.

License

MIT

You can’t perform that action at this time.