A few days ago I made a question: how could I made a insert into datatable taking the table name from a variable.
This was the solution:
var nameOfTable = "here I saved the name of table where i want to insert my information"
var type = ((IQueryable)db.GetType().GetProperty(nameOfTable).GetValue(db)).ElementType;
var dbSet = db.Set(type);
dbSet.AddRange(informationIWantToInsert);
db.SaveChanges();
Now I want to make something similar but this time I want to make a "dynamic" select, like this:
SELECT *
FROM nameOfTable
where foreign_key = number
I want to get all rows that meet the condition and y want to pass the name of table by variable.