Skip to content

How to pass table name dynamically in entity framework mvc5

Seshu B

Seshu B

Asked Jun 5, 2017, 1:37 AM EDT1 answer
Share
LinkedInX
Hi all
i want to pass tablename as dynamically to get column names list in mvc5
 
i have tried like this
 
C#
public List<string> GetColumnNames(string tablename)
        {
            using (var Context = new MCPEntities())
            {
                var names = typeof(AdministratorInformation).GetProperties().Select(property => property.Name).ToArray();
                return names.ToList();

            }
        }

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.