Well, I was not very lucky with that. I'm new to the Entity Framework, and have been scared with this little thing ever since.
Here are my tables:
- Clients (id, clientname)
- Projects (id, projectname, clientid)
- Tasks (id, taskname, projectid, statusid)
- TaskStatuses (id, statusname)
In code, I only work with one project at a time, and here is how I load this project using EF:
thisProject = (from p in dataEntity.projects
where p.id == projectID
select p).FirstOrDefault();
Then later, when I load tasks:
thisProject.Tasks.Load();
Then I install the DevExpress XtraGrid data source for the downloaded tasks:
taskGridControl.DataSource = thisProject.Tasks;
Up to this point, everything works as expected, and the grid shows all the tasks for the project I downloaded. But I also want to show the "Task Status" field and is stored in another table.
It was very easy with sql connection, but for life I can not understand it.