Repository: dotnet/efcore
File: test/EFCore.Relational.Specification.Tests/Update/ComplexCollectionJsonUpdateTestBase.cs (C#)

Code before:
        public required string PostalCode { get; set; }
        public required string Country { get; set; }
    }

    protected class Department
    {
        public required string Name { get; set; }
        public decimal Budget { get; set; }
    }

    public abstract class ComplexCollectionJsonUpdateFixtureBase : SharedStoreFixtureBase<DbContext>
    {
        protected override string StoreName
            => "ComplexCollectionJsonUpdateTest";

        public TestSqlLoggerFactory TestSqlLoggerFactory
            => (TestSqlLoggerFactory)ListLoggerFactory;

        protected override bool ShouldLogCategory(string logCategory)
            => logCategory == DbLoggerCategory.Update.Name;

        protected override Type ContextType
            => typeof(ComplexCollectionJsonContext);

        protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
        {
            modelBuilder.Entity<CompanyWithComplexCollections>(b =>
            {
            => modelBuilder.Entity<CompanyWithComplexCollections>(b =>
            {
                b.Property(x => x.Id).ValueGeneratedNever();

                    {
                        cb.ToJson();
                        cb.PrimitiveCollection(e => e.PhoneNumbers);
                        cb.ComplexProperty(e => e.Address);
                    });

                b.ComplexProperty(
                    x => x.Department, cb =>
                    {
                        cb.ToJson();
                    });
            });

        protected override Task SeedAsync(DbContext context)
        {
            var company = new CompanyWithComplexCollections
            {
                Id = 1,
                Name = "Test Company",

Review comment (suggestion):
```suggestion
            => modelBuilder.Entity<CompanyWithComplexCollections>(b =>
            {
                b.Property(x => x.Id).ValueGeneratedNever();

                b.ComplexCollection(
                    x => x.Contacts, cb =>
                    {
                        cb.ToJson();
                        cb.PrimitiveCollection(c => c.PhoneNumbers);
                    });

                b.ComplexCollection(
                    x => x.Employees, cb =>
                    {
                        cb.ToJson();
                        cb.PrimitiveCollection(e => e.PhoneNumbers);
                        cb.ComplexProperty(e => e.Address);
                    });

                b.ComplexProperty(
                    x => x.Department, cb =>
                    {
                        cb.ToJson();
                    });
            });
```

Code after:
        public required string PostalCode { get; set; }
        public required string Country { get; set; }
    }

    protected class Department
    {
        public required string Name { get; set; }
        public decimal Budget { get; set; }
    }

    public abstract class ComplexCollectionJsonUpdateFixtureBase : SharedStoreFixtureBase<DbContext>
    {
        protected override string StoreName
            => "ComplexCollectionJsonUpdateTest";

        public TestSqlLoggerFactory TestSqlLoggerFactory
            => (TestSqlLoggerFactory)ListLoggerFactory;

        protected override bool ShouldLogCategory(string logCategory)
            => logCategory == DbLoggerCategory.Update.Name;

        protected override Type ContextType
            => typeof(ComplexCollectionJsonContext);

        protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
            => modelBuilder.Entity<CompanyWithComplexCollections>(b =>
            {
                b.Property(x => x.Id).ValueGeneratedNever();

                b.ComplexCollection(
                    x => x.Contacts, cb =>
                    {
                        cb.ToJson();
                        cb.PrimitiveCollection(c => c.PhoneNumbers);
                    });

                b.ComplexCollection(
                    x => x.Employees, cb =>
                    {
                        cb.ToJson();
                        cb.PrimitiveCollection(e => e.PhoneNumbers);
                        cb.ComplexProperty(e => e.Address);
                    });

                b.ComplexProperty(
                    x => x.Department, cb =>
                    {
                        cb.ToJson();
                    });
            });