使用实体框架和MySql

时间:2019-09-29 13:23:22

标签: c# mysql entity-framework-6

Entities map 我在使用实体框架在mysql表中执行巨大更新时遇到了一些麻烦。我想做的很简单: UPDATE客户端SET description ='new description',ID> = 5。 这是已安装的nuGet软件包的列表:

  

EntityFramework 6.2.0   MySql.Data 8.0.17   MySql.Data.Entity 6.10.9   MySql.Data.Entity 6.10.9   MySql.Data.EntityFramework 8.0.17   Z.EntityFramework.Extensions 4.0.5

我正在使用MySql 8.0.17。 我正在使用ConsoleApp Framework 4.7.2。

这是我的代码:

using ConsoleApp8.EFModel;
using System;
using System.Collections.Generic;
using System.Linq;


namespace ConsoleApp8
{
    class Program
    {
        static void Main(string[] args)
        {
            EFModel.georgeEntities dbContext = new EFModel.georgeEntities();
            dbContext.Database.Log = Console.Write;

            var result = dbContext.client.Where(x => x.id >= 5)
                                .UpdateFromQuery<client>(new Dictionary<string, object>() {{ "description", "New Value" }});
        }
    }
}

但是我得到的只是一个错误:

未处理的异常:: MySql.Data.MySqlClient.MySqlException:表'george.george.client'不存在

您必须知道的是'george'是架构名称。读取错误后,我认为EntityFramework扩展正在复制架构名称。

有人使用与Mysql一起使用EntityFramework或我使用了错误的扩展库吗?

预先感谢您的帮助! Interel

0 个答案:

没有答案
相关问题