Print Page | Close Window

IsPendingEntityList return true for already loaded entities

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=4030
Printed Date: 12-May-2026 at 10:59pm


Topic: IsPendingEntityList return true for already loaded entities
Posted By: myr_zero
Subject: IsPendingEntityList return true for already loaded entities
Date Posted: 11-Mar-2013 at 11:01pm

First I will explain what I am trying to do.

 

I have DevForce Silverlight application. I am using Remote Server Method (RSM/RPC) to execute a set of queries to data base at server side. Server method returns EntityCacheState to client. I merge the entity manager cache received from server with client side entity manager cache. I verify the number of entities I have in client side cache, it is same as server cache and same as what is there is database. Everything is fine till now.

 

Now I execute the same query at client side (query that was earlier executed at server side), but with query strategyQueryStrategy.CacheOnly.

 

This is the query at server side

 

entityManager.GetQuery<MetadataRule>()

                .AddIncludePaths(new string[] { "BaseEntity""MetadataRuleConditions.BaseEntity","MetadataRuleConditions.MetadataCondition.BaseEntity" })                      

                        .ExecuteAsync()

 

This is the query at client side.

 

entityManager.MetadataRules

                .AddIncludePaths(new string[] { "BaseEntity""MetadataRuleConditions.BaseEntity","MetadataRuleConditions.MetadataCondition.BaseEntity" })

                .With(QueryStrategy.CacheOnly)

                .ExecuteAsync()

 

Include paths specified are valid.

 

I executed the following test at client side after the server cache is merged with client cache

entityManager.MetadataRules

                .AddIncludePaths(new string[] { "BaseEntity""MetadataRuleConditions.BaseEntity","MetadataRuleConditions.MetadataCondition.BaseEntity" })

                .With(QueryStrategy.CacheOnly)

                .ExecuteAsync(res =>

                {

                    var metaDataRules = res.Results.Cast<MetadataRule>().ToList();

 

                    foreach (var rule in metaDataRules)

                    {

                        if (rule.MetadataRuleConditions.IsPendingEntityList)

                        {

                            throw new Exception("Conditions loading is pending in cache");

                        }                        

                    }

                });

 

 

 

This throw exception. For one of the MetadataRule, property is MetadataRuleConditions.IsPendingEntityList true. Which means related entity MetadataRuleConditions is not loaded. I verified in the data base for the number of rows for this navigation. The count is zero, which is correct.

The same validation is successful at server side.

 

If I verify client cache, all the entities present at client cache, no entities are missing. Ideally the property MetadataRuleConditions.IsPendingEntityList  should return false, but this is not the case here.

 

What is the issue here??

Is there a work around for this??

 




Replies:
Posted By: sbelini
Date Posted: 13-Mar-2013 at 5:07pm
Hi Myr_zero,

I was able to reproduce the problem and filed a bug report. We are working on a fix.

Note that the IsPendingEntityList is not being properly updated during the ECS merge only if the EntityList is actually empty. (i.e. MetadataRules has no MetadataRuleConditions associated with it) If the EntityList has at least one element, then the IsPendingEntityList is properly set to false.

sbelini.


Posted By: myr_zero
Date Posted: 13-Mar-2013 at 8:48pm
Thank for the update sbelini :)

Just wanted to know is the same bug exists in devforce 2012 too?? Or does migration to devforce solves this problem??


Posted By: myr_zero
Date Posted: 13-Mar-2013 at 10:04pm
We have this problem in production system, and this is very critical for us.

Can you please let me know the ETA for this bug fix?? We would be delighted if you can provide a work around that can be used in the mean time.

Thank you


Posted By: sbelini
Date Posted: 14-Mar-2013 at 7:59am
myr_zero,

I haven't tested yet, but I suspect the issue might be present in DevForce2012 too. I'll check and confirm.

We don't have estimate time for this fix, but it's a high priority.

Unfortunately, I can't think of a workaround other than resolving the RelatedEntityList so that IsPendingEntityList is properly updated. Like I mentioned before, the bug is only present on empty RelatedEntityLists, so there wouldn't be entities being actually retrieved. (although there's still the call to the server)


Posted By: myr_zero
Date Posted: 18-Mar-2013 at 2:33am
sbelini

I tested this issue in DevForce 2012 after successful migration. The issue exists there too :(


Posted By: smi-mark
Date Posted: 18-Mar-2013 at 9:59am
Can you not simply just do

if (rule.MetadataRuleConditions.IsPendingEntityList) //no conditions
    continue;

until the bug is fixed?


Posted By: sbelini
Date Posted: 01-Apr-2013 at 4:19pm
myr_zero,

After further investigation of this issue, we determine that a fix would cause a performance hit that does not justify fixing it.

I'm confused as to why you are checking IsPendingEntityList. If you are retrieving all entities via RSM, I assume you'd know that the related entities have also been loaded. If your goal is to not allow a second trip to the server to try to retrieve the related entities, (which are none, since this problem only exists on empty related entities) you could simply set the LoadStrategy to DoNotLoad:

MetadataRule.PropertyMetadata.MetadataRuleConditions.ReferenceStrategy = new EntityReferenceStrategy(EntityReferenceLoadStrategy.DoNotLoad, MergeStrategy.OverwriteChanges);


I'm also curious why you have opted to retrieve the entities via RSM rather then just querying them.



Posted By: myr_zero
Date Posted: 02-Apr-2013 at 9:20pm
Hi

The only reason we are using RSM is "performance". We want to make use of high performing resources available at server side, which can execute thousands of lines of code in fractions of a second. We don't have control over client side resources since the application can be accessed from any device from anywhere in the world. And also doing expensive executions at server side provide the advantage of giving same performance on all the clients.

This is what we are doing. We have a set of queries to retrieve data form DB. On that data we have a set of expensive calculation to be performed before we show the result on the screen. And also we want the entities retrieved to be available in Cache for the life time of application.

Initially we used parallel co-routines to retrieve data, but the performance is very low. Then we tried RSM. We moved parallel co-routine and the expensive calculation to server side, so that we can get what we required in a single trip to server, hence reducing server round trips and also making use of the better resources of server.

This actually gave us very good improvement in performance.

And about checking IsPendingEntityList. This is the usual verification for data validity. We have common code which is unaware about how data is retrieved. Whether its RSM or client side call. And also we have lazy loading at client side. To make sure that all the data required is present before we proceed further we are checking property IsPendingEntityList.


Do you have any suggestions??

Thanks
Manju



Print Page | Close Window