views:

12

answers:

1

Hi, I'm trying to use the .LoadWith method

I have these lines of code in my domainservice:

public IEnumerable<Subject> GetSubjectList(Guid userid)
        {
            DataLoadOptions loadopts = new DataLoadOptions();
            loadopts.LoadWith<Subject>(s => s.Notes);
            this.DataContext.LoadOptions = loadopts;
            return this.DataContext.Subjects;
        }

I can see debugging that a list of subjects get loaded, and that the Subjects.Notes property which is a List is also populated with subitems, but when I do

ctx.Load(ctx.GetSubjectListQuery(WebContext.Current.User.UserId), lo => 
                {
                    serverdata = ctx.Subjects; 
                }, null);

I only get a flat list of subjects loaded into serverdata, and no note subitems are loaded to subject.notes

A: 

I had not added [Include] to my metadata properties of my domainservice.

Jakob