LINQ Select from dynamic tableName string
问题 I want to get list of records from an entity model (I'm using EF version 5) with a particular accountID. I'm being supplied with the tableName string (this has to be dynamic) and the accountID. I'm trying the following 2 methods but none of them is working (giving me errors on the IQueryable object 'table': PropertyInfo info = _db.GetType().GetProperty(tableName); IQueryable table = info.GetValue(_db, null) as IQueryable; var query = table.Where(t => t.AccountID == accID) .Select(t => t);