I'd like to retrieve a table from a variable value. For example, instead of:
myContext.Customers.ToList()
I want to use something like:
var tableName = "Customers"
myContext.tableName.ToList()
Can anyone steer me in the right direction? TIA!
I'd like to retrieve a table from a variable value. For example, instead of:
myContext.Customers.ToList()
I want to use something like:
var tableName = "Customers"
myContext.tableName.ToList()
Can anyone steer me in the right direction? TIA!
In theory you should be able to do something similar to this:
var eType = Type.GetType($"{EntityNameSpace}.{tableName}");
myContext.Set(eType).ToList();