I have a strange situation. I have a simple project to test RIA functionality in Silverlight 4.0.
When I use a data source for a domain service, it works fine, but when I want to access the Context from the code and execute a simple query, I return 0 rows.
var q = ctx.GetDoctorsWithPatientsAndHospitalQuery();
var result = ctx.Load(q);
EntityQuery<Doctor> query =
from c in ctx.GetDoctorsWithPatientsAndHospitalQuery()
select c;
LoadOperation<Doctor> loadOp = this.ctx.Load(query);
var result2 = loadOp.Entities;
var result3 = ctx.Doctors.ToList();
It is also strange that when I want to add a new entity instance from the code, it works fine.
Doctor newDoctor = new Doctor()
{
FirstName = firstNameTextBoxNew.Text,
LastName = lastNameTextBoxNew.Text,
Hospital_Id = tmp,
Hospital = tmpH
};
ctx.Doctors.Add(newDoctor);
ctx.SubmitChanges();
Can someone tell me what I did wrong to make a selection from the code?
Regards, Daniel Skourowski
source
share