I've this code and everything works just fine.
using (var db = new ApplicationDbContext())
{
md = db.Modles.ToList();
}
My question is that I have a parameter called M
and that is the name of a Model I've created, so it can be dynamic.
Is there a way to do something like this:
var M = "Modles"; // or M = "Modles2"
using (var db = new ApplicationDbContext())
{
md = db[M].ToList();
}
I've tried Entity Framework Get Table By Name and Entity Framework get table by variable name but without any luck. Can this be done?