Skip to content

Commit

Permalink
Merge pull request #41 from TrackableEntities/fix-travsrse-graph
Browse files Browse the repository at this point in the history
Fix TraverseGraph HashSet
  • Loading branch information
tonysneed authored Nov 24, 2020
2 parents 07ab457 + c4e11d2 commit 2d8ae52
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions TrackableEntities.EF.Core/DbContextExtensionsInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ public static void TraverseGraph(this DbContext context, object item,
var node = new EntityEntryGraphNode<object>(stateManager.GetOrCreateEntry(item), null, null, null);
IEntityEntryGraphIterator graphIterator = new EntityEntryGraphIterator();
#pragma warning restore EF1001 // Internal EF Core API usage.
var visited = new HashSet<int>();
var visited = new HashSet<object>();

graphIterator.TraverseGraph<object>(node, n =>
graphIterator.TraverseGraph(node, n =>
{
// Check visited
if (visited.Contains(n.Entry.Entity.GetHashCode()))
if (visited.Contains(n.Entry.Entity))
return false;

// Execute callback
callback(n);

// Add visited
visited.Add(n.Entry.Entity.GetHashCode());
visited.Add(n.Entry.Entity);

// Continue traversal
return true;
Expand Down
4 changes: 2 additions & 2 deletions TrackableEntities.EF.Core/TrackableEntities.EF.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageVersion>5.0.0</PackageVersion>
<PackageVersion>5.0.1</PackageVersion>
<Authors>Tony Sneed</Authors>
<Company>Tony Sneed</Company>
<Title>Trackable Entities for EF Core</Title>
Expand All @@ -12,7 +12,7 @@
<PackageProjectUrl>https://github.com/TrackableEntities/TrackableEntities.Core</PackageProjectUrl>
<PackageIcon>icon.png</PackageIcon>
<PackageTags>change-tracking entity-framework-core n-tier</PackageTags>
<PackageReleaseNotes>See: https://github.com/TrackableEntities/TrackableEntities.Core/releases/tag/v5.0.0</PackageReleaseNotes>
<PackageReleaseNotes>See: https://github.com/TrackableEntities/TrackableEntities.Core/releases/tag/v5.0.1</PackageReleaseNotes>
<IncludeSource>true</IncludeSource>
</PropertyGroup>

Expand Down

0 comments on commit 2d8ae52

Please sign in to comment.