I have Calls table:
Call(id, reason_id, company_id, text)
I have Reason table:
Reason(id, name)
I have Company table:
Company(id, name)
Calls has a foreign key to Reason and Company
I am using Entity Framework 4 and I would like to display a list of calls and for each call display the text, reason name and company name.
Something like an inner join.
I have added the tables to the edmx file. how can I get the data I need? which POCO object will hold the external data (company name and reason name)?
Maybe you can use the concept of ViewModel:
=======================
//select all data from _entities Call Table
var result = (from s in _entities.Call.Include(“Reason”).Include(“Company”) select s).ToList();
//get first data’s ReasonName
var ReasonName = result[0].Reason.ReasonName;
//get first data’s CompanyName
var CompanyName = result[0].Company.CompanyName;