First of all, I have seen this post: Raw SQL Query without DbSet - Entity Framework Core but I feel like it does not answer my question.
I have an ASP.NET Core MVC project with Entity Framework Core (newest at this date).
What I need to do is:
public IActionResult MyView(string NameOfTable)
{
// send model that is same as NameOfTable
// or
// send something like List<string> that has properties and names of columns
return View();
}
What I want to do is call a function and send the name of a table in database. It will find the table in the database and return the properties of table (column names, types of columns[int/ varchar..]).
What I think will work: either write raw SQL to database.
What I think is good answer: some snippet of how to write raw SQL to query the database without knowing a model. Or some way of overcoming this problem.
Thanks for everything. Sorry if this is dumb question.