If I'm using EF 5 and Database first to generate a .edmx model of my database, how do I get a list of an entity's columns?
using (var db = new ProjectNameContext())
{
// string[] colNames = db.Users.
}
What I'm looking for is colNames[0] == "Id", colNames[1] == "FirstName", etc.
How about:
var names = typeof(User).GetProperties()
.Select(property => property.Name)
.ToArray();
Of course, this can be used for any type, not just an EF table.