开发者

DomainService Include() Method Not Returning Children To Silverlight Client

This is dr开发者_运维知识库iving me mad, I've got a DomainService call which on the server contains an Include() to return child objects as follows:

public IQueryable<RegionBorder> GetRegionBordersWithPolygonsAndLatLongs()
    {
        return this.ObjectContext.RegionBorders.Include("RegionPolygons.LatLongs");
    }

I've set this line as a debug point on the server and it is generating the correct results with the child collections included within the toplevel entities. However, on the client, I cannot access the children. The client code is as follows:

EntityQuery<RegionBorder> query = idc.GetRegionBordersWithPolygonsAndLatLongsQuery();
        LoadOperation<RegionBorder> lo = idc.Load<RegionBorder>(query);
        lo.Completed += delegate(object sender, EventArgs e1)
        {
            //regionBorders = idc.RegionBorders;
            string prtyName = "ProjOverspend";
            var elements = new Collection<FrameworkElement>();
            var propertySet = new ExtendedPropertySet();
            propertySet.RegisterProperty(prtyName, prtyName, typeof(double), 0d);

            foreach (RegionBorder ent in idc.RegionBorders)
            {
                foreach (RegionPolygon rp in ent.RegionPolygons)
                {
                    Telerik.Windows.Controls.Map.MapPolygon mp = new Telerik.Windows.Controls.Map.MapPolygon();
                    mp.Points = rp.Points;
                    elements.Add(mp);
                    SetExtendedProperty(propertySet, prtyName, mp, 0d);
                }
            }

Can anybody help me with where I am going wrong because I am sure this was working fine before and now just will not do anything.

Thanks for any help.

Martyn.


You have to add IncludeAttribute in metadata as well.


Is there any way of making the Domain Service Dialog in VS2010, which generates the metadata, automatically add the [Include] and [Association("[String name]", "[String thisKey]", "[String otherKey]")] tags?

It is quite a bit of work to maintain and test if you, for some reason, need to regenerate the Domain Service, if you eg. implemented many/major changes in the Entity Model.

Is it nessecary to add the [Association("", "", "")] tags, when the model already contains this information due to its relations (foreign keys)?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜