jeudi 3 septembre 2015

Get column by table name entity framework reflection

I need to get column name and value from a table which I know only the name. I try lot of stuff but without success.

I use this for get my table :

var table = oSession.ctx.GetType()
                       .GetProperty("country")
                       .GetValue(oSession.ctx, null);

I'm lock with that I can't retrieve the informations of my columns .. Perhaps I have already try this :

List<string> columnsNames = table.GetType().GetFields().Select(field => field.Name).ToList();

Thx for your help..





Aucun commentaire:

Enregistrer un commentaire