New Posts New Posts RSS Feed: Async Navigation in SL causes modified entities
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Async Navigation in SL causes modified entities

 Post Reply Post Reply
Author
pompomJuice View Drop Down
Newbie
Newbie
Avatar

Joined: 29-Jul-2010
Location: ZA
Posts: 28
Post Options Post Options   Quote pompomJuice Quote  Post ReplyReply Direct Link To This Post Topic: Async Navigation in SL causes modified entities
    Posted: 12-Oct-2010 at 8:54am
Hi.

Whenever I access Navigational properties of entities in Silverlight asynchronously, my entities get marked as "Modified" by devforce. This is causing severe confusion in my UI.

Any idea when this might be fixed?

W
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 12-Oct-2010 at 1:15pm

Hi,

 
How are you acesssing the navigation properties?
I wrote a small test (below) and the nav properties are Unchanged.
 
Can you provide a test case (preferably against NorthwindIB) reproducing the issue?
 
 
var employeesQuery = mgr.Employees.Include("Orders");
mgr.ExecuteQueryAsync(
  employeesQuery,
    args => {
      if (args.HasError) {
        throw args.Error;
      }
      var orders = args.Results.First().Orders;
      var numberOfOrders = orders.Count();
      Random randNum = new Random();
      var index = randNum.Next(numberOfOrders - 1);
      var anOrder = orders[index];
      if (anOrder.EntityAspect.EntityState == EntityState.Unchanged) {
        MessageBox.Show("EntityState is Unchanged as expected");
      } else {
        MessageBox.Show("Something is wrong. EntityState is " + anOrder.EntityAspect.EntityState.ToString());
      }
    },
    null);
Back to Top
pompomJuice View Drop Down
Newbie
Newbie
Avatar

Joined: 29-Jul-2010
Location: ZA
Posts: 28
Post Options Post Options   Quote pompomJuice Quote  Post ReplyReply Direct Link To This Post Posted: 13-Oct-2010 at 12:51am
That is not going to produce the error. You are not accessing anything asynchronously in that test.

The kind of navigation I am talking about is the same as what would happen between the Product.SupplierID relationship.

Try something like this:

                mgr.ExecuteQueryAsync(mgr.Products).Completed+=(s,e)=>
                {
                    e.Results.ToList().ForEach( p =>
                        {
                            p.Supplier.EntityAspect.PendingEntityResolved+=(sender,args)=>
                                {
                                    if (p.EntityAspect.EntityState == EntityState.Unchanged)
                                    {
                                        MessageBox.Show("EntityState is Unchanged as expected");
                                    }
                                    else
                                    {
                                        MessageBox.Show("Something is wrong. EntityState is " + p.EntityAspect.EntityState.ToString());
                                    }
                                };
                        });
                };

The call to r.Supplier triggers devforce to fetch the supplier asynchronously, while handing a fake one to you. So far so good. Once the async  fetch is complete however, the fake value is supposed to get a PropertyChangedEvent. Instead no event seems to occur and r.Supplier is marked as modified. Disaster!


Edited by pompomJuice - 13-Oct-2010 at 1:01am
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 13-Oct-2010 at 6:56am
pompomJuice - we've fixed this bug in the 6.0.6 release.   This release is due out within a week, and an EAP build is available now upon request.
Back to Top
pompomJuice View Drop Down
Newbie
Newbie
Avatar

Joined: 29-Jul-2010
Location: ZA
Posts: 28
Post Options Post Options   Quote pompomJuice Quote  Post ReplyReply Direct Link To This Post Posted: 13-Oct-2010 at 7:08am
That is good news. Thanks!
Back to Top
pompomJuice View Drop Down
Newbie
Newbie
Avatar

Joined: 29-Jul-2010
Location: ZA
Posts: 28
Post Options Post Options   Quote pompomJuice Quote  Post ReplyReply Direct Link To This Post Posted: 20-Oct-2010 at 2:06am
Confirmed this issue is fixed in 6.06.


Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down