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.