Entity Framework - how do I get the columns?

后端 未结 7 1549
后悔当初
后悔当初 2020-12-01 14:25

I wish to get a list of columns names, types and whether the column is a PK of a table object in Entity Framework.

How do I do this in C# (4.0) (ideally generically)

7条回答
  •  鱼传尺愫
    2020-12-01 14:52

    if you want only column names then ,i got the best answer :
    var properties = (from t in typeof(YourTableName).GetProperties() select t.Name).ToList(); var name= properties[0];

提交回复
热议问题