Right now, I have created a new Object data source based off from an Object Context from the entity model. I then created a BindingSource and a DataGridView set to this BindingSource.
I can add columns which are bound to the data from the TraceLine table. When I set the DataSource, I see values in those columns. However, I can’t seem to get the data from the joined table. How do I bind a DataGridView to a query that has a join?
using (var entities = new MyEntities())
{
var lines = from t in entities.Lines
join m in entities.Methods on t.MethodHash equals m.MethodHash
where t.UserSessionProcessId == m_SessionId
select new
{
m.Name, // doesn't get displayed in DataGridView, but I want it to
t.Sequence,
t.InclusiveDuration,
t.ExclusiveDuration
};
dgvBindingSource.DataSource = lines;
}