开发者

RIA Services: Server process returns multiple entities but Client shows 1 entity duplicated

I am running into an issue where RIA Services returns 3 entities from the server (I have verified while debugging on the server process, and have v开发者_运维知识库erified via Fiddler that the service is in face returning 3 entities.

I am using MVVM so I am calling Load on the client side using a helper function that I borrowed from a Shawn Wildermuth sample: Here's that code:

    // Generic query handling
     protected void PerformQuery<T>(DomainContext dc, string name, EntityQuery<T> qry, EventHandler<EntityResultsArgs<T>> evt) where T : Entity
    {
        dc.Load<T>(qry,(r) =>
        {
            if (evt != null)
            {
                try
                {
                    if (r.HasError)
                    {
                        evt(this, new EntityResultsArgs<T>(r.Error));
                    }
                    else if (r.Entities.Count() > 0)
                    {
                        evt(this, new EntityResultsArgs<T>(r.Entities));
                    }
                }
                catch (Exception ex)
                {
                    evt(this, new EntityResultsArgs<T>(ex));
                }
            }
        }, null);
    }

EntityResultsArgs is a simple class that exposes an exception property (called Error) and a Results property (containing the results if we got any).

On the server we are mapping the result using AutoMapper to our exposed Domain Classes and this particular service call returns IEnumerable.

What am I missing (or what more would help someone figure this out).

Thanks!


Yep, the problem is now confirmed. I was retrieving 3 entities back from the service all with an Id (aka the "[Key]" value) of 0.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜