1
Answer

How to pass table name dynamically in entity framework mvc5

Photo of Seshu B

Seshu B

7y
441
1
Hi all
i want to pass tablename as dynamically to get column names list in mvc5
 
i have tried like this
 
public List<string> GetColumnNames(string tablename)
{
using (var Context = new MCPEntities())
{
var names = typeof(AdministratorInformation).GetProperties().Select(property => property.Name).ToArray();
return names.ToList();

}

Answers (1)

0
Photo of Vivek Kumar
NA 7.6k 729.8k 7y
Have a look into the below links.
 
https://stackoverflow.com/questions/19704364/entity-framework-getting-a-tables-column-names-as-a-string-array
 
https://schneids.net/get-table-info-for-your-entities-in-entity-framework/