Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating hierarchies Question #4622

Open
parvic1 opened this issue Jan 12, 2024 · 0 comments
Open

Updating hierarchies Question #4622

parvic1 opened this issue Jan 12, 2024 · 0 comments
Assignees
Milestone

Comments

@parvic1
Copy link

parvic1 commented Jan 12, 2024

[Enter feedback here]
I have run this same example with a twist by updating the hierarchy so that Polo, descendant of Ponto, is actually a descendant of Mungo.
It turns out that Polo will get the same Hierarchy path as Belba "/1/2/" but I was expecting to Polo to have "/1/6/".
How can be done?

Hierachy

    var poloAndDescendants = await context.Halflings.Where(
            descendent => descendent.PathFromPatriarch.IsDescendantOf(
                context.Halflings.Single(ancestor => ancestor.Name == "Polo").PathFromPatriarch))
        .ToListAsync();

    foreach (var descendent in poloAndDescendants)
    {
        descendent.PathFromPatriarch
            = descendent.PathFromPatriarch.GetReparentedValue(
                ponto.PathFromPatriarch, mungo.PathFromPatriarch)!;
    }

Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

@ajcvickers ajcvickers added this to the Backlog milestone Feb 1, 2024
@ajcvickers ajcvickers self-assigned this Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants