Select from database table with fieldname and table as parameters

Viewed 21

How can I make a similiar SQL select request with Entity Framework?

public void DoStuff(string fieldName, string tableName)
{
   string query = $"select ID, {fieldName} from {tableName}";
}

The code example above was used with ADO.net library. Now I am using Microsoft.EntityFrameworkCore (6.0.7) with Microsoft SQL-server database.

0 Answers
Related