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

SqlHierarchy doesn't produce child ids properly #10

Closed
jmounce opened this issue Oct 20, 2018 · 3 comments
Closed

SqlHierarchy doesn't produce child ids properly #10

jmounce opened this issue Oct 20, 2018 · 3 comments
Labels
bug Something isn't working

Comments

@jmounce
Copy link

jmounce commented Oct 20, 2018

I think this line needs to change to:
public SqlHierarchyId GetDescendant(SqlHierarchyId child1, SqlHierarchyId child2) => new SqlHierarchyId(_imp.GetDescendant(child1.IsNull ? default(HierarchyId?) : child1._imp, child2.IsNull ? default(HierarchyId?) : child2._imp));
Otherwise, you can't create the first child. Unless I'm missing something...

@dotMorten
Copy link
Owner

dotMorten commented Oct 20, 2018

Thanks. Do you have an example I can use for a unit test to confirm behavior?

@jmounce
Copy link
Author

jmounce commented Oct 21, 2018

This is what I used. Simple enough:
`
[Fact]
public void InsertFirstChild()
{
SqlHierarchyId id = Types.SqlHierarchyId.GetRoot();
SqlHierarchyId idChild = id.GetDescendant(Types.SqlHierarchyId.Null, Types.SqlHierarchyId.Null);

		Assert.Equal(id, idChild.GetAncestor(1));
	}

`

@dotMorten
Copy link
Owner

Thanks! Fixed with ad8744f

@dotMorten dotMorten added the bug Something isn't working label Oct 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants