I have the following query in a Silverlight app, in a function that is called from inside of a coroutine (the caller does a yield return on the return value of the function:
IEnumerable<PogSectionGroup> sectionGroups = null;
var qrySections =
em.ProjectPOGs.Where(
p => p.ProjectID == project.ProjectID &&
p.PogType == (int)sectionPogType)
.OrderBy(p => p.SFFDecrementNum)
.GroupBy(p => p.POGID)
.Select(p => new PogSectionGroup { PogID = p.Key, Sections = p });
return qrySections.ExecuteAsync(op => sectionGroups = op.Results);
The code fails when it references op.Results, with the error:
The Remote server returned an error: NotFound
PogSectionGroup is a POCO class that is compiled both in a serverside-referenced domain model,
and client-side referenced domain model (SL dll):
[DataContract]
public class PogSectionGroup : IHasEntityAspect, IKnownType
{
public enum SectionSortMetricType
{
VPE,
VPEperSFF
}
[Key]
public int PogID { get; set; }
[DataMember]
public IEnumerable<ProjectPOG> Sections { get; set; }
private ProjectPOG _currentSection;
private int _currentIdx;
public static SectionSortMetricType SectionSortMetric(Enums.OptimizationBasis optBasis)
{
Debug.Assert(optBasis != Enums.OptimizationBasis.UnknownOptimization);
return (optBasis == Enums.OptimizationBasis.IncrementVPEperSKU ||
optBasis == Enums.OptimizationBasis.NonIncrementVPEperSKU)
? SectionSortMetricType.VPE
: SectionSortMetricType.VPEperSFF;
}
public bool MustKeepSection(int projectLastDelPriority, ProjectConstraint constraint)
{
return _currentSection.MustKeepSection(projectLastDelPriority, constraint);
}
public void Reset()
{
_currentIdx = 0;
_currentSection = Sections.ElementAt(_currentIdx);
}
public ProjectPOG NextSection()
{
ProjectPOG nextSec = _currentSection;
_currentSection = null;
_currentIdx++;
if (_currentIdx < Sections.Count()) _currentSection = Sections.ElementAt(_currentIdx);
return nextSec;
}
[ReadOnly(true)]
[IgnoreDataMember]
public int BestItemDelPriority { get { return Convert.ToInt32(_currentSection.BestItemDelPrio); } }
[ReadOnly(true)]
[IgnoreDataMember]
public double VPEperSFF { get { return _currentSection.VPEperSFF; } }
[ReadOnly(true)]
[IgnoreDataMember]
public double VPE { get { return Convert.ToDouble(_currentSection.VPE_CUR); } }
[IgnoreDataMember]
public EntityAspect EntityAspect { get; set; }
}
I do not have a POCO service provider for this POCO class,
but even if I add one, I still get the error
Any ideas?
Thanks,