This question is locked. New answers and comments are not allowed.
Hi all,
Apologies if this is a stupid question, but I'm having a mental block.
I have a set of classes which have relationships between them (as FKs in the database), for example:
I've added a metadata class like so:
I then rebuild, and re-run the data services wizard to update the WCF service definition.
However, when I try to retrieve the objects in my consuming class via the following:
the project entity (pp.Project) is null.
Do I need to manually edit the DataManager class to add .Include("Project") to the query? I would assume not, because I assume the Include attribute (in System.ServiceModel.DomainServices.Server - not the ones in Telerik.OpenAccess) is supposed to indicate to the ORM autogeneration stuff that it should add it.
Or am I missing something else entirely?
Cheers!
Apologies if this is a stupid question, but I'm having a mental block.
I have a set of classes which have relationships between them (as FKs in the database), for example:
public partial class ProjectProfile{ private long _projectId; public virtual long ProjectId { get { return this._projectId; } set { this._projectId = value; } } // ... more class members private Project _project; public virtual Project Project { get { return this._project; } set { this._project = value; } } }I've added a metadata class like so:
[MetadataTypeAttribute(typeof(ProjectProfileMetaData))]public partial class ProjectProfile{ internal sealed class ProjectProfileMetaData { [Include] [Association("Project", "ProjectId", "ProjectId")] public Project Project { get; set; } }}I then rebuild, and re-run the data services wizard to update the WCF service definition.
However, when I try to retrieve the objects in my consuming class via the following:
ILookup<string, ProjectProfile> profiles = (from pp in dataManager.ProjectProfiles where ((pp.ProfileYear == startDate.Year && pp.ProfileMonth >= startDate.Month) || pp.ProfileYear >= startDate.Year) && ((pp.ProfileYear == endDate.Year && pp.ProfileMonth <= endDate.Month) || pp.ProfileYear < endDate.Year) select pp).OrderBy(pp => pp.ProfileYear).ThenBy(pp => pp.ProfileMonth).ToLookup(pp => pp.Project.ProjectStatus.ProjectShowsOn);the project entity (pp.Project) is null.
Do I need to manually edit the DataManager class to add .Include("Project") to the query? I would assume not, because I assume the Include attribute (in System.ServiceModel.DomainServices.Server - not the ones in Telerik.OpenAccess) is supposed to indicate to the ORM autogeneration stuff that it should add it.
Or am I missing something else entirely?
Cheers!