Error In :EntityGraph while calling Synchronize API.

Dec 16, 2011 at 9:57 AM

I'm encountering error "source graph entity graph must be copy or clone of present entity graph"  while calling Synchronize method from orgional graph.

I have noticed one more thing before temp context submit the entites collection was same in origional and clone graph,but after complettion temp context submission the clone graph entities has been reduced but orgional graph having same entities.

Code

  public void ExecutePartialSave(EntityGraphShape shape, TaskRequest taskRequest)
        {

 TempContext tempContext = new  TempContext();

            EntityGraph graph = new EntityGraph(taskRequest, shape);   //old Graph

            var clone = graph.Clone(tempContext); //new Graph


            tempContext.SubmitChanges(submitOperation =>
            {
                if (submitOperation.HasError)
                {
                }
                else
                {
                    graph.Synchronize(clone); Encoutering error here.
                }

if any have suggestion.Please share with me.

 

Developer
Dec 16, 2011 at 2:00 PM

Did you delete any entities or did you only add or modify existing entities?

Dec 19, 2011 at 2:47 PM

i have not deleted/modified any entities.seems some problem present in Shap.can you share sample shape whcih contain around 20 tables relationship details.

 

Dec 20, 2011 at 1:38 PM
Edited Dec 20, 2011 at 1:40 PM

Hi Mdej,

This is my EntityGraphShape.

        EntityGraphShape shape = new EntityGraphShape().Edge<Request,MailRequest>(j => j.MailRequests)
        .Edge<MailRequest, DirectMailComponent>(dmr => dmr.MailComponents)
        .Edge<Request, RDigitalResource>(j => j.RDigitalResources)
        .Edge<RDigitalResource, DigitalResource>(jrdr => jrdr.DigitalResource)
        .Edge<DigitalResource, DigitalResourceAsset>(dr => dr.DigitalResourceAssets)
        .Edge<DigitalResource, DigitalAssetFile>(dr => dr.DigitalAssetFile)
        .Edge<DigitalAssetFile, DigitalResourceAsset>(da => da.DigitalResourceAssets);

Before temp context submit the entites collection was same in origional and clone graph,but after complettion temp context submission the clone graph entities has been reduced but orgional graph having same entities.

After temp context submission following entities are not present in clone graph,due to missing following entites we were encoutering thise error "Source graph entity graph must be copy or clone of present entity graph"  in graph.Synchronize method.

   .Edge<DigitalResource, DigitalResourceAsset>(dr => dr.DigitalResourceAssets)
        .Edge<DigitalResource, DigitalAssetFile>(dr => dr.DigitalAssetFile)
        .Edge<DigitalAssetFile, DigitalResourceAsset>(da => da.DigitalResourceAssets);

Developer
Dec 22, 2011 at 8:46 AM

Hi,

I need a little more information:

  • Could you show me what the result of tempContext.EntityContainer.GetChanges() gives?
  • Do all your entities have server-side generated keys?
Jan 11, 2012 at 3:13 AM

Hi Mdej,

I'm following up this query.  tempContext.EntityContainer.GetChanges() gives the following result :

{Added = 0, Modified = 0, Removed = 0}

AddedEntities: Count = 0

IsEmpty: true

ModifiedEntities: Count = 0

RemovedEntities: Count = 0

 

I want to show you the diagram how tables are associated . Could you please let me know how to send the diagram picture?

 
Developer
Jan 11, 2012 at 1:59 PM

Is it possible to email me the source code of the classes involved in the entity graph?