问题描述
我想问-是否可以在DNX Core 5.0中连接到MySql数据库?在我的项目中,我需要执行Web api,并且我有vNext类库项目,该项目应该连接到MySql数据库并处理该数据库中的数据.但是...
我安装了最新的.net/connector.我已经下载了MySql.Data NuGet程序包,并在参考文献中将它同时添加到了DNX 4.5.1和Core 5.0中.但是我遇到了错误-功能(例如,打开与数据库的连接,执行查询等功能)在DNX Core 5.0中不可用.该代码在Visual Studio 2013和DNX 4.5.1中均有效.我找不到如何在DNX Core 5.0中连接到MySql的任何答案(即使不可能).
建议我缩减最新连接器/net的源代码,然后将MySql.Data的代码复制到新的vNext类库项目中,并添加对应该访问的类库的引用数据库.但是我有大约1600个错误. 告诉我一个一个地解决它们.但这似乎是更大的问题.似乎可以通过添加几个参考来解决,但我找不到适用于DNX Core 5.0的等效参考. 这是一个好方法吗?
我将不胜感激.谢谢.
还不错,它尚未出现在EntityFramework 7中,我的理解是,他们没有将其优先级安排在计划在一月份的初始版本中.
了解更多: https://github.com/aspnet/EntityFramework/wiki/使用EF7-in-Traditional-.NET应用程序
I would like to ask- is it possible to connect to MySql database in DNX Core 5.0? In my project I need to do web api and I have vNext Class Library project that should connect to MySql database and manipulate the data in this database. But...
I have the newest .net/connector installed. I have downloaded the MySql.Data NuGet package and in references it is added to both- DNX 4.5.1 and Core 5.0 as well. But I get error- functions such as open the connection to my database, execute query etc are not available in DNX Core 5.0. The code is working in Visual Studio 2013 and in DNX 4.5.1 as well. I am not able to find any answer how to connect in DNX Core 5.0 to MySql (neither if it is even possible).
I was advised to downolad the source code of the newest connector/net and copy the code for MySql.Data to new vNext Class Library project and add reference to my Class Library that is supposed to access the database. But I have approx 1600 errors. I was told to solve them one by one. But that seems to be even bigger problem. It looks like it would be possible to solve by adding several references but I cannot find the equivalent reference that would work for DNX Core 5.0. Is this a good approach?
I would appreciate any help. Thank you.
Saldy it's not in EntityFramework 7 yet, my understanding is that they're not prioritizing it for the initial release that's scheduled in January.
Read more:https://github.com/aspnet/EntityFramework/wiki/Using-EF7-in-Traditional-.NET-Applications
这篇关于DNX 5.0中的MySql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!