I have a simple .Net Framework routine which runs a query and returns a DataTable object. I need to port this to .Net Core, however I infer that SQLAdapter and DataTable ar
You can use DbDataAdapter link for more info
Then use this function for CreateDataAdapter
private static DbDataAdapter CreateDataAdapter(this DbConnection connection, DbCommand command)
{
var adp = DbProviderFactories.GetFactory(connection).CreateDataAdapter();
adp.SelectCommand = command;
return adp;
}
Then normal can use like code below
var connection = Context.Database.GetDbConnection();
using var command = connection.CreateCommand();
command.CommandText = cmdText;
using DbDataAdapter adp = connection.CreateDataAdapter(command);
After you can fill
using DataSet dataSet = new DataSet();
adp.Fill(dataSet);