MySql in DNX 5.0

大城市里の小女人 提交于 2020-01-01 04:42:07

问题


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.


回答1:


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




回答2:


I have a similar question running.

DNXCORE 5.0 and mysql / mariadb

At this moment it is not possible to run MySQL and DNX 5.0! If you want to use it with DNX, you have to fall back on 4.5.1 ( and use mono for Linux environments )

This is because there is no connector available for MySQL. If applicable, you can use postgresql with DNX 5.0 in stead of MySQL/MariaDB



来源:https://stackoverflow.com/questions/31278301/mysql-in-dnx-5-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!