0

I was trying to get the model a page is looking to and send data based on the Model received. I have tried the following code but it says 'model' is a variable but is used as a Type

public IActionResult GetComments(string modelName)
        {
Type model = Type.GetType(modelName+", UHDMS.Models");
                var mapping = _context.Model.FindEntityType(model);
                tablename = mapping.GetTableName();

                var props = _context.Model.GetEntityTypes().Single(e => (e.GetTableName().OfType<model>()).Equals(tablename)).GetProperties();

}

Note: error is happening on this line e.GetTableName().OfType()

  • 1
    Does this answer your question? [How do I use reflection to call a generic method?](https://stackoverflow.com/questions/232535/how-do-i-use-reflection-to-call-a-generic-method) –  May 12 '20 at 07:44
  • Can you post _context code. – neelesh bodgal May 12 '20 at 07:53

0 Answers0