I am looking to get a list of the column names returned from a Model. Anyone know how this would be done, any help would be greatly appreciated.
Example Code:
var project = db.Projects.Single(p => p.ProjectID.Equals(Id));
This code would return the Projects object, how would I get a list of all the column names in this Model.
Thanks
I am sorry, I don’t have working experience with LINQ.
This is purely based on looking at MSDN.
DataContexthas aMappingproperty, which returns an instance ofMetaModel.MetaModelhasGetMetaType, which takes aType. In your case it could betypeof(Project).GetMetaTypereturns aMetaTypewhich has theGetDataMembermethod, which takes aMemberInfoparameter. You will have to use reflection on yourProjectsobject to get theMemberInfoobject.The
MetaDataMemberinstance returned byGetDataMembershould have all the things, you need.I hope I am somewhat in right direction (purely looking at MSDN & traversing)