2017-02-10 144 views
0

Im做一个SQL查询与EF核心,但我encodig返回错误,编码MySql的EF核心

DATABSE设置:

  • 字符集:latin1的
  • 归类:latin1_general_ci

数据库 - engine InnoDb - charset:latin1 - collat​​ion:latin1_general_ci

这是一个MySQL数据库

enter image description here

enter image description here

public Repository(CrmGatewayCarteirasContext context) 
    { 
     Context = context; 
     DbSet = context.Set<TEntity>(); 
    } 

    public void Dispose() 
    { 
     Dispose(true); 
     GC.SuppressFinalize(this); 
    } 

    public IEnumerable<TEntity> GetAll() 
    { 
     return DbSet.ToList(); 
    } 

    protected virtual void Dispose(bool disposing) 
    { 
     if (_disposed) return; 
     _disposed = true; 
    } 

project.json

{ 
"dependencies": { 
    "Microsoft.NETCore.App": { 
     "version": "1.1.0", 
     "type": "platform" 
    }, 
    "Microsoft.AspNetCore.Routing": "1.1.0", 
    "Microsoft.AspNetCore.Diagnostics": "1.1.0", 
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0", 
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0", 
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0", 
    "Serilog.Extensions.Logging": "1.3.1", 
    "Serilog.Sinks.RollingFile": "3.3.0", 
    "Serilog.Exceptions": "2.3.0", 
    "Seq.Extensions.Logging": "2.1.1", 
    "Serilog.Sinks.Seq": "3.2.0", 
    "Microsoft.EntityFrameworkCore.Design": { 
     "type": "build", 
     "version": "1.1.0" 
    }, 
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0", 
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0", 
    "Microsoft.Extensions.Configuration.FileExtensions": "1.1.0", 
    "Microsoft.Extensions.Configuration.Json": "1.1.0", 
    "Microsoft.Extensions.Logging": "1.1.0", 
    "Microsoft.Extensions.Logging.Console": "1.1.0", 
    "Microsoft.Extensions.Logging.Debug": "1.1.0", 
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0", 
    "AutoMapper": "5.2.0", 
    "AutoMapper.Extensions.Microsoft.DependencyInjection": "1.2.0", 
    "CrmGateway.SharedKernel": "1.0.0-*", 
    "Microsoft.ApplicationInsights.AspNetCore": "2.0.0", 
    "Microsoft.AspNetCore.Mvc": "1.1.1", 
    "SapientGuardian.EntityFrameworkCore.MySql": "7.1.18", 
    "StaticCommons": "1.4.0" 
}, 
"tools": { 
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final", 
    "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0-preview3-final", 
    "Microsoft.EntityFrameworkCore.Tools": { 
     "version": "1.1.0-preview4-final", 
     "imports": [ 
      "portable-net45+win8+dnxcore50", 
      "portable-net45+win8" 
     ] 
    } 
}} 

回答