New Posts New Posts RSS Feed: IsPendingEntity always false
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

IsPendingEntity always false

 Post Reply Post Reply
Author
tj62 View Drop Down
Groupie
Groupie
Avatar

Joined: 21-May-2009
Location: Iceland
Posts: 81
Post Options Post Options   Quote tj62 Quote  Post ReplyReply Direct Link To This Post Topic: IsPendingEntity always false
    Posted: 13-Jan-2011 at 6:29am
Hi,
Using DevForce versoin 6.0.6.0 for Silverlight:
I'm starting using navigation properties in Silverlight making use of the PendingEntityResolved such when an image is requested by the parent entity (building entity, EntBuilding) i retrive the image-navigation property (EntImage): 

// This is a code snipped from my view model.
// A databound blob, a Value converter in the XAML takes care of valu conversion andis  proofed to work
  public byte[] p_image /
        {
            get
            {
                if (p_currentItem == null)  // If no item is selected return null
                    return null;
                EntBuilding b = (EntBuilding) p_currentItem; // The type is guranteed to be EntBuilding

// Some test commented out
                // var test = EntBuilding.PropertyMetadata.p_image.GetEntityReference(b);
                // test.IsLoaded = false;

                if (b.p_image.EntityAspect.IsPendingEntity) // always returns false!!
                {
                    b.p_image.EntityAspect.PendingEntityResolved += OnPendingEntImageResolved;
                }
                return b.p_image.p_image;
            }
        }

        private void OnPendingEntImageResolved(object sender, PendingEntityResolvedEventArgs e)
        {
            if (p_currentItem is EntBuilding)
                RaisePropertyChanged("p_image");
        }

The strange thing is that b.p_image.EntityAspect.IsPendingEntity is allways false, although it has not been loaded. 
After investigating my Entity model better I notice that all not-loaded navigation propertis are having IsPendingEntity = false but GetEntityReference(xx).IsLoaded = false. The same is tro for IsPendingEntityList. It is allways true alothugh the navigatoin collectoin properties have not been loaded.

How can that be?
PS: I'm using Entity Model against INformis Dynamic Server version 11.5 without any problems until now.
Back to Top
tj62 View Drop Down
Groupie
Groupie
Avatar

Joined: 21-May-2009
Location: Iceland
Posts: 81
Post Options Post Options   Quote tj62 Quote  Post ReplyReply Direct Link To This Post Posted: 13-Jan-2011 at 7:23am
Found the reason. Well one should never copy/paste from Ward Bell without reading the code :-). I had copied in some code from the PrismExplorer. In his repository class query method he calls:

p_entityManager.DefaultQueryStrategy = QueryStrategy.Normal; // Ensure going to data source

and then in the callback he calls:
p_entityManager.DefaultQueryStrategy = QueryStrategy.CacheOnly; // Prevent accidental async lazy loads

This of course stops everyting and causes IsPendingEntity = false all the time.

So the solution was to comment out the line in the callback and after that everything works fine!...Actualy I refined this stuff a little. Wards code is a little bit too simple :-)


Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down