Reputation: 123
I have created a Web API built on .NET Framework 4.7.2. I want to be able to communicate with SQL Server without using Entity Framework.
Microsoft.Data.SqlClient
and System.Data.SqlClient
are not compatible with .NET Framework 4.7.2. I really do not want to use any ORM.
Any suggestions?
Upvotes: 0
Views: 3319
Reputation: 123
I figured it out. I build a .net Standard library instead of a .net Framework library.
Upvotes: 0
Reputation: 79
You can use dapper for example:
var data = new List<DapperTest>();
using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["Analysis"].ConnectionString))
{
data = db.Query<DapperTest>("select * from testTable").ToList();
}
return data;
Upvotes: 1