Repository: dotnet/efcore
File: test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBase.cs (C#)

Code before:
                    e.SourceId,
                    e.PrimaryGroup
                });
                b.Property(e => e.PrimaryGroup).ValueGeneratedOnAdd();
            });

            modelBuilder.Entity<BoolOnlyKey<bool>>(b =>
            {
                b.HasKey(e => e.PrimaryGroup);
                b.Property(e => e.PrimaryGroup).ValueGeneratedOnAdd();
            });

            modelBuilder.Entity<BoolOnlyKey<bool?>>(b =>
            {
                b.HasKey(e => e.PrimaryGroup);
                b.Property(e => e.PrimaryGroup).ValueGeneratedOnAdd();
            });

            modelBuilder.Entity<ChildWithSetDefault>(b =>
            {
                b.Property(e => e.ParentId).HasSentinel(667);
                b.HasOne(e => e.Parent)
                    .WithMany(e => e.Children)
                    .HasForeignKey(e => e.ParentId)
                    .OnDelete(DeleteBehavior.ClientSetDefault);
            });

            modelBuilder.Entity<ChildWithSetDefaultValue>(b =>
            {
                b.Property(e => e.ParentId).HasSentinel(667);
                b.HasOne(e => e.Parent)
                    .WithMany(e => e.Children)
                    .HasForeignKey(e => e.ParentId)
                    .OnDelete(DeleteBehavior.SetDefault);
            });
        }

        private class StableGuidGenerator : ValueGenerator<Guid>
        {
            private readonly ConcurrentDictionary<object, Guid> _guids = new(ReferenceEqualityComparer.Instance);

            public override Guid Next(EntityEntry entry)
                => _guids.GetOrAdd(entry.Entity, _ => Guid.NewGuid());

            public override bool GeneratesTemporaryValues
                => false;

            public override bool GeneratesStableValues
                => true;
        }


Review comment (suggestion):
This should use `HasDefaultValue` as we are interested in the value being set by the database

Code after:
                    e.SourceId,
                    e.PrimaryGroup
                });
                b.Property(e => e.PrimaryGroup).ValueGeneratedOnAdd();
            });

            modelBuilder.Entity<BoolOnlyKey<bool>>(b =>
            {
                b.HasKey(e => e.PrimaryGroup);
                b.Property(e => e.PrimaryGroup).ValueGeneratedOnAdd();
            });

            modelBuilder.Entity<BoolOnlyKey<bool?>>(b =>
            {
                b.HasKey(e => e.PrimaryGroup);
                b.Property(e => e.PrimaryGroup).ValueGeneratedOnAdd();
            });

            modelBuilder.Entity<ParentWithClientSetDefault>(b =>
            {
                b.Property(e => e.Id).ValueGeneratedNever();
            });

            modelBuilder.Entity<ChildWithClientSetDefault>(b =>
            {
                b.Property(e => e.ParentId).HasSentinel(667);
                b.HasOne(e => e.Parent)
                    .WithMany(e => e.Children)
                    .HasForeignKey(e => e.ParentId)
                    .OnDelete(DeleteBehavior.ClientSetDefault);
            });
        }

        private class StableGuidGenerator : ValueGenerator<Guid>
        {
            private readonly ConcurrentDictionary<object, Guid> _guids = new(ReferenceEqualityComparer.Instance);

            public override Guid Next(EntityEntry entry)
                => _guids.GetOrAdd(entry.Entity, _ => Guid.NewGuid());

            public override bool GeneratesTemporaryValues
                => false;

            public override bool GeneratesStableValues
                => true;
        }

        protected virtual object CreateFullGraph()
            => new Root
            {
                AlternateId = RootAK,