This question is locked. New answers and comments are not allowed.
I have a Silverlight project utilizing ORM. in my Web project I have created a method to fetch a custom class and its related data.
I am not seeing the related ILists reflected in the Silverlight project when I implement the method:
I have tried both the FetchStrategy and the simpler Include() method (noted below for reference) to no avail. All I get in the Silverlight project is the top tier Web.Appointment objects. What am I not doing right?
public
IQueryable<Web.Appointment> GetAppointmentsByResource(
int
rscID)
{
FetchStrategy fetch =
new
FetchStrategy();
fetch.LoadWith<Web.Appointment>(f => f.Appt2Rescs);
fetch.LoadWith<Web.Appointment>(f => f.Attendees);
this
.DataContext.FetchStrategy = fetch;
return
this
.DataContext.Appointments
.Where(w => w.Appt2Rescs.Any(r => r.ResourceFK == rscID));
}
I am not seeing the related ILists reflected in the Silverlight project when I implement the method:
LoadOperation<Web.Appointment> loadAppts = dc.Load(dc.GetAppointmentsByResourceQuery(aid));
loadAppts.Completed += (s, a) =>
{
foreach
(Web.Appointment app
in
loadAppts.Entities)
{
foreach
(Attendee att
in
app.Attendees)
//app.Attendees is not there
{
Console.WriteLine(att.UserName);
}
}
}
I have tried both the FetchStrategy and the simpler Include() method (noted below for reference) to no avail. All I get in the Silverlight project is the top tier Web.Appointment objects. What am I not doing right?
public
IQueryable<Web.Appointment> GetAppointmentsByResource(
int
rscID)
{
return
this
.DataContext.Appointments
.Include(a => a.Appt2Rescs)
.Include(a => a.Attendees)
.Where(w => w.Appt2Rescs.Any(r => r.ResourceFK == rscID));
}