.Net 核心 MySql [英] .Net Core MySql

查看:16
本文介绍了.Net 核心 MySql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始在 Ubuntu 14.04.4 上使用 .NET Core 在 Visual Studio Code 中编码我习惯于在工作中使用 Ubuntu(出于个人兴趣、爱好等)以及 .NET 和 Visual Studio.

I've just started coding in Visual Studio Code with .NET Core, on Ubuntu 14.04.4 I'm used to both using Ubuntu (from personal interests, hobby, etc) and .NET and Visual Studio at work.

但是我遇到了一个似乎无法克服的问题.我正在构建一个想要与 MySql 服务器通信的小型控制台应用程序,但我似乎无法让 MySql.ConnectorNET.Data 正常工作.

But I've run into a problem i can't seem to overcome. I'm building a small console app that i want to communicate with a MySql Server, but I can't seem to get the MySql.ConnectorNET.Data working properly.

它是用命令 dnu install MySql.ConnectorNET.Data 安装的,这似乎工作正常.在project.json文件中添加了依赖,intellisense能够遍历包就好了,但是OmniSharp Log报告说:

It was installed with the command dnu install MySql.ConnectorNET.Data And that seemed to work fine. The dependency was added in the project.json file, and intellisense was able to traverse the package just fine, but the OmniSharp Log reports that:

[INFORMATION:OmniSharp.Dnx.DnxProjectSystem] Project /home/<username>/VSCode/SimpleSQLatmpt/project.json has these unresolved references: MySql.ConnectorNET.Data

我似乎无法解决这个问题.VSCode 似乎检测到它,并要求我运行 dnu restore 命令.但这无济于事.出于所有意图和目的,似乎 MySql.ConnectorNET.Data 在项目中可用,但无法使用.

and I simply can't seem to fix that. VSCode seems to detect it, and asks me to run the dnu restore command. But it's to no avail. For all intends and purposes it seems like MySql.ConnectorNET.Data is available in the project, but just can't be used.

谁能告诉我如何解决这个问题?同样重要的是,它为什么会首先发生?

Can any one tell me how to fix this? And just as important, why it is happening in the first place?

非常感谢您抽出宝贵时间.

Thank you very much for your time.

推荐答案

在提出这个问题时(2016 年 3 月),没有与 .NET Core 兼容的 ADO.NET 提供程序用于 MySQL.

At the time of this question (Mar 2016) there was no .NET Core-compatible ADO.NET provider for MySQL.

现在情况改变了:

  • MySqlConnector 由 Bradley Grainger 编写 -- 获得麻省理工学院许可,并提供完整的异步支持莉>
  • MySql.Data (>6.10) 由 Oracle 提供(传统上,GPL)
  • MySqlConnector written by Bradley Grainger -- licensed under MIT, and offers full async support
  • MySql.Data (>6.10) provided by Oracle (traditionally, GPL)

我个人更喜欢MySqlConnector——它可以免费用于商业项目(MIT许可);我也在 Linux 下用我的 NReco.Data 库对其进行了测试,它在我的场景中完美运行.不幸的是,MySqlConnector 还不支持 EF Core.

Personally I prefer MySqlConnector -- it can be used in commercial projects for free (MIT license); also I've tested it with my NReco.Data library under Linux, and it works perfectly in my scenarious. Unfortunately, MySqlConnector doesn't support EF Core yet.

--- 更新 --

另外一个与 .NET Core 兼容的 MySQL 连接器 + EF Core MySQL 提供程序:

One more .NET Core-compatible MySQL connector + EF Core MySQL provider:

  • Pomelo.Data.MySql (unfortunately it doesn't implement true async behaviour)
  • Pomelo.EntityFrameworkCore.MySql

这篇关于.Net 核心 MySql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆