如何在面向 .NET Core 的 Visual Studio 2015 中引用 System.Data? [英] How to reference System.Data in Visual Studio 2015 targeting .NET Core?

查看:30
本文介绍了如何在面向 .NET Core 的 Visual Studio 2015 中引用 System.Data?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试访问类库中的 IDbConnection 接口,以便创建一个连接对象来连接数据库并从数据库中获取数据,但是我无法访问 IDbConnectioncode> 接口应该在 System.Data.dll 中.

I am trying to access the IDbConnection interface in a class library in order to make a connection object that connects and fetches data from the database, but I just cannot access the IDbConnection interface which was supposed to by in System.Data.dll.

我在 NuGet 中也找不到它.那么,我该怎么做呢?

I can't find it anywhere in NuGet either. So, how do I go about it?

微软是否也改变了我们连接数据库的方式,或者 .NET Core 中是否引入了任何新接口?

Has Microsoft changed the way we make connections to a database as well, or is there any new interface introduced in .NET Core?

推荐答案

IDbConnectionIDbCommand 等接口已从 System.Data 中删除..NET Core 中的 Common 命名空间.它们已被 DbConnectionDbCommand 等抽象类所取代.您可以在此处阅读有关此事的讨论.

The IDbConnection, IDbCommand etc. interfaces has been removed from the System.Data.Common namespace in .NET Core. They've been replaced by the DbConnection, DbCommand etc. abstract classes. You can read a discussion on the matter here.

您可以查看 System.Data.Common 的 .NET Core 进度 这里.将来,如果您不确定类型是否已被移动或删除,这可能是一个检查的好地方.

You can take a look at the .NET Core progress for System.Data.Common here. In the future, if you're uncertain whether types have been moved or removed, this might be a good place to check.

您要安装的 NuGet 包是 System.Data.Common,其中包含提到的类型.

The NuGet package you want to install is System.Data.Common, which contains the mentioned types.

这篇关于如何在面向 .NET Core 的 Visual Studio 2015 中引用 System.Data?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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