Entity Framework Core provider for MySql built on top of mysql-net/MySqlConnector
C# Other
Clone or download
caleblloyd Merge pull request #584 from robbieknuth/robbieknuth/guid_literals
Introduce custom type mapping for old guid literals.
Latest commit 06a254c Aug 3, 2018
Permalink
Failed to load latest commit information.
.github Update ISSUE_TEMPLATE.md Aug 2, 2016
.vscode KoreBuild, TravisCI, and AppVeyor Updates May 29, 2018
build upgrade Pomelo.JsonObject to 2.0.0 Jul 18, 2018
src Merge pull request #584 from robbieknuth/robbieknuth/guid_literals Aug 3, 2018
test remove unnecessary dependencies Jul 11, 2018
tools MigrationSqlGenerator WIP May 31, 2018
upstream add upstream folder with reference code May 28, 2018
.editorconfig Code Cleanup and Refactoring! Feb 20, 2018
.gitattributes fix the ComputedColumn convention May 31, 2018
.gitignore KoreBuild, TravisCI, and AppVeyor Updates May 29, 2018
.travis.yml .travis.yml Integration Tests with EF_BATCH_SIZE=10 must export env v… Jul 6, 2018
Directory.Build.props KoreBuild, TravisCI, and AppVeyor Updates May 29, 2018
Directory.Build.targets KoreBuild, TravisCI, and AppVeyor Updates May 29, 2018
LICENSE Update LICENSE Jun 22, 2017
NuGet.config use preview2-final Jun 30, 2017
Pomelo.EntityFrameworkCore.MySql.sln KoreBuild, TravisCI, and AppVeyor Updates May 29, 2018
README.md upgrade Pomelo.JsonObject to 2.0.0 Jul 18, 2018
appveyor.yml appveyor.yml Integration Tests with EF_BATCH_SIZE=10 must set env var… Jul 6, 2018
build.cmd KoreBuild, TravisCI, and AppVeyor Updates May 29, 2018
build.sh KoreBuild, TravisCI, and AppVeyor Updates May 29, 2018
dotnet-run.ps1 KoreBuild, TravisCI, and AppVeyor Updates May 29, 2018
dotnet-run.sh KoreBuild, TravisCI, and AppVeyor Updates May 29, 2018
korebuild-lock.txt upgrade upstream to 2.1.1 Jul 3, 2018
korebuild.json KoreBuild, TravisCI, and AppVeyor Updates May 29, 2018
run.cmd KoreBuild, TravisCI, and AppVeyor Updates May 29, 2018
run.ps1 KoreBuild, TravisCI, and AppVeyor Updates May 29, 2018
run.sh KoreBuild, TravisCI, and AppVeyor Updates May 29, 2018
version.props bump to 2.1.2-preview1 Jul 11, 2018

README.md

Pomelo.EntityFrameworkCore.MySql

Travis build status AppVeyor build status NuGet MyGet 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.

Pomelo.EntityFrameworkCore.MySql is currently looking for core contributors

Nightly Builds

To use nightly builds from our MyGet 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://www.myget.org/F/pomelo/api/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 you to set utf8mb4 as your MySQL database default charset. The following statement will check your DB charset:

show variables like 'character_set_database';

2. CSPROJ Configuration

Ensure that your .csproj file has the following references.

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.1" />
    <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.1.1" />
  </ItemGroup>
  
</Project>

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;

namespace YourNamespace // replace "YourNamespace" with the namespace of your application
{
    public class Startup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            // other service configurations go here
            services.AddDbContextPool<YourDbContext>( // replace "YourDbContext" with the class name of your DbContext
                options => options.UseMySql("Server=localhost;Database=ef;User=root;Password=123456;", // replace with your Connection String
                    mysqlOptions =>
                    {
                        mysqlOptions.ServerVersion(new Version(5, 7, 17), ServerType.MySql); // replace with your Server Version and Type
                    }
            ));
        }
    }
}

View our MySql Provider 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.

Schedule and Roadmap

Milestone Release week
2.1.1 7/8/2018

Scaffolding Tutorial

Using the tool to execute scaffolding commands:

dotnet ef dbcontext scaffold "Server=localhost;Database=ef;User=root;Password=123456;" "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.

License

MIT