Repository: dotnet/efcore
File: src/EFCore.Design/Migrations/Design/CSharpSnapshotGenerator.cs (C#)

Code before:
        foreach (var property in properties)
        {
            GenerateProperty(entityTypeBuilderName, property, stringBuilder, isInComplexCollection);
        }
    }

    /// <summary>
    ///     Generates code for an <see cref="IProperty" />.
    /// </summary>
    /// <param name="entityTypeBuilderName">The name of the builder variable.</param>
    /// <param name="property">The property.</param>
    /// <param name="stringBuilder">The builder code is added to.</param>
    protected virtual void GenerateProperty(
        string entityTypeBuilderName,
        IProperty property,
        IndentedStringBuilder stringBuilder)
        => GenerateProperty(entityTypeBuilderName, property, stringBuilder, isInComplexCollection: false);

    /// <summary>
    ///     Generates code for an <see cref="IProperty" />.
    /// </summary>
    /// <param name="entityTypeBuilderName">The name of the builder variable.</param>
    /// <param name="property">The property.</param>
    /// <param name="stringBuilder">The builder code is added to.</param>
    /// <param name="isInComplexCollection">Whether the property is in a complex collection.</param>
    protected virtual void GenerateProperty(
        string entityTypeBuilderName,
        IProperty property,
        IndentedStringBuilder stringBuilder,
        bool isInComplexCollection)
    {
        var clrType = (FindValueConverter(property)?.ProviderClrType ?? property.ClrType)
            .MakeNullable(property.IsNullable);

        var propertyCall = property.IsPrimitiveCollection ? "PrimitiveCollection" : "Property";
        var propertyBuilderName = $"{entityTypeBuilderName}.{propertyCall}<{Code.Reference(clrType)}>({Code.Literal(property.Name)})";

        stringBuilder
            .AppendLine()
            .Append(propertyBuilderName);

        // Note that GenerateAnnotations below does the corresponding decrement
        stringBuilder.IncrementIndent();

        // ComplexCollectionTypePropertyBuilder doesn't have IsConcurrencyToken method
        if (!isInComplexCollection && property.IsConcurrencyToken)
        {
            stringBuilder
                .AppendLine()
                .Append(".IsConcurrencyToken()");
        }

Review comment (suggestion):
@copilot Don't add this overload, instead examine `property.DeclaringType`

Code after:
        IProperty property,
        IndentedStringBuilder stringBuilder)
    {
        var clrType = (FindValueConverter(property)?.ProviderClrType ?? property.ClrType)
            .MakeNullable(property.IsNullable);

        var propertyCall = property.IsPrimitiveCollection ? "PrimitiveCollection" : "Property";
        var propertyBuilderName = $"{entityTypeBuilderName}.{propertyCall}<{Code.Reference(clrType)}>({Code.Literal(property.Name)})";

        stringBuilder
            .AppendLine()
            .Append(propertyBuilderName);

        // Note that GenerateAnnotations below does the corresponding decrement
        stringBuilder.IncrementIndent();

        // ComplexCollectionTypePropertyBuilder doesn't have IsConcurrencyToken method
        var isInComplexCollection = property.DeclaringType is IComplexType complexType
            && complexType.ComplexProperty.IsCollection;

        if (!isInComplexCollection && property.IsConcurrencyToken)
        {
            stringBuilder
                .AppendLine()
                .Append(".IsConcurrencyToken()");
        }

        if (property.IsNullable != (clrType.IsNullableType() && !property.IsPrimaryKey()))
        {
            stringBuilder
                .AppendLine()
                .Append(".IsRequired()");
        }

        // ComplexCollectionTypePropertyBuilder doesn't have ValueGenerated* methods
        if (!isInComplexCollection && property.ValueGenerated != ValueGenerated.Never)
        {
            stringBuilder
                .AppendLine()
                .Append(
                    property.ValueGenerated == ValueGenerated.OnAdd
                        ? ".ValueGeneratedOnAdd()"
                        : property.ValueGenerated == ValueGenerated.OnUpdate
                            ? ".ValueGeneratedOnUpdate()"
                            : property.ValueGenerated == ValueGenerated.OnUpdateSometimes
                                ? ".ValueGeneratedOnUpdateSometimes()"
                                : ".ValueGeneratedOnAddOrUpdate()");
        }

        GeneratePropertyAnnotations(propertyBuilderName, property, stringBuilder);
    }