Giter VIP home page Giter VIP logo

Comments (3)

JonathanMagnan avatar JonathanMagnan commented on July 20, 2024

Hello @fdahlberg ,

Thank you for reporting,

We will investigate this issue very soon and give you an answer.

Best Regards,

Jonathan


Help us to keep this library free: Donate

from graphdiff.

JonathanMagnan avatar JonathanMagnan commented on July 20, 2024

Hello @fdahlberg ,

We have a lot investigated this issue to better understand why this is happening.

We find out that the issue is caused by this method: https://github.com/zzzprojects/GraphDiff/blob/master/GraphDiff/GraphDiff/Internal/Graph/GraphNode.cs#L106-L122

        protected static void AttachCyclicNavigationProperty(IObjectContextAdapter context, object parent, object child)
        {
            if (parent == null || child == null) return;


            var parentType = ObjectContext.GetObjectType(parent.GetType());
            var childType = ObjectContext.GetObjectType(child.GetType());


            var navigationProperties = context.GetNavigationPropertiesForType(childType);


            var parentNavigationProperty = navigationProperties
                    .Where(navigation => navigation.TypeUsage.EdmType.Name == parentType.Name)
                    .Select(navigation => childType.GetProperty(navigation.Name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public))
                    .FirstOrDefault();


            if (parentNavigationProperty != null)
                parentNavigationProperty.SetValue(child, parent, null);
        }

The child is an object of the original entity which gets assigned the parent of the new entity.

We tested some scenario which could make existing child entities work but unfortunately for new entities, there is nothing we have found that we can do for now.

Removing this code will lead to more issue since some navigation property will not be correctly copied.

We can leave this issue open but I don't think we will do something until we choose to re-write this library.

Let me know if you need a better explanation of the issue.

Best Regards,

Jonathan


Help us to keep this library free: Donate

from graphdiff.

fdahlberg avatar fdahlberg commented on July 20, 2024

Hi Jonathan,

Thanks for investigating. It's a shame it can't be fixed but I can live with this. As a workaround I create a clone of the incoming object before using UpdateGraph.

Thanks
Fred

from graphdiff.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.