I am working on an ASP.net page that also users ChartFX. I need to pull a row from a database table and then flip it so that all of the labels for the row are in a column and all of the data from the row is in a parallel column to the labels.
I would really like to do this using LINQ and then create a table in memory to store these values until I need to use them. What do you all suggest?
Using method I found at How would I get the column names from a Model LINQ?
var db = new DataContextType();
var members = db.Mapping.MappingSource
.GetModel(typeof(DataContextType))
.GetMetaType(typeof(TableType))
.DataMembers;
var row = …; // select the desired row
var namesAndValues = from member in members
select new
{
Name = member.Name,
Value = member.MemberAccessor.GetBoxedValue(row)
};