简体   繁体   中英

How to reference System.Data in Visual Studio 2015 targeting .NET Core?

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 .

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

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

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 .

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM