Repository navigation
Declare DbSet properties as auto-properties without initializers - #10697
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review comments were identified, and all supplied approval assessments indicate readiness for approval.
No open issues 🎉
What changed in this PR
This pull request standardizes Entity Framework Core DbSet<T> declarations across tests, examples, benchmarks, and Mocha documentation using settable auto-properties without redundant null! initializers or expression-bodied Set<T>() accessors.
Changes:
- Replaces expression-bodied
DbSet<T>properties with{ get; set; }auto-properties. - Removes redundant
= null!initializers. - Updates Mocha examples and documentation to use the same EF Core declaration style.
| File | Description |
|---|---|
website/content/docs/mocha/sagas.md |
Updates the saga DbSet documentation example. |
website/content/docs/mocha/reliability.md |
Updates outbox and inbox DbSet documentation examples. |
src/Mocha/test/Mocha.EntityFrameworkCore.Tests/EntityFrameworkTransactionMiddlewareTests.cs |
Standardizes the test context property. |
src/Mocha/test/Mocha.EntityFrameworkCore.Postgres.Tests/PostgresOutboxConnectionLifetimeTests.cs |
Standardizes the PostgreSQL test context property. |
src/Mocha/src/Examples/Reliability/OutboxInbox/OutboxInbox.cs |
Updates the outbox, inbox, and order set declarations. |
src/Mocha/examples/Demo/Demo.Shipping/Data/ShippingDbContext.cs |
Updates shipping demo set declarations. |
src/Mocha/examples/Demo/Demo.Catalog/Data/CatalogDbContext.cs |
Updates catalog demo set declarations. |
src/Mocha/examples/Demo/Demo.Billing/Data/BillingDbContext.cs |
Updates billing demo set declarations. |
src/HotChocolate/Spatial/test/Data.Projections.SqlServer.Tests/DatabaseContext.cs |
Removes the generic set initializer. |
src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/DatabaseContext.cs |
Removes the generic set initializer. |
src/HotChocolate/Data/test/Data.Tests/TestContext2/FooBarContext.cs |
Removes null! initializers. |
src/HotChocolate/Data/test/Data.Tests/TestContext2/CatalogContext.cs |
Removes null! initializers. |
src/HotChocolate/Data/test/Data.Tests/TestContext2/AnimalContext.cs |
Removes null! initializers. |
src/HotChocolate/Data/test/Data.Tests/TestContext1/CatalogContext.cs |
Removes null! initializers. |
src/HotChocolate/Data/test/Data.Sorting.SqlLite.Tests/QueryableSortVisitorProjectionTests.cs |
Removes the test set initializer. |
src/HotChocolate/Data/test/Data.Sorting.SqlLite.Tests/DatabaseContext.cs |
Removes the generic set initializer. |
src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/DatabaseContext.cs |
Removes the generic set initializer. |
src/HotChocolate/Data/test/Data.PostgreSQL.Tests/Issue8252UnionProjectionTests.cs |
Standardizes the projection context property. |
src/HotChocolate/Data/test/Data.PostgreSQL.Tests/DateTimeOffsetSortingTests.cs |
Removes the test set initializer. |
src/HotChocolate/Data/test/Data.PostgreSQL.Tests/Data/CatalogContext.cs |
Standardizes catalog set declarations. |
src/HotChocolate/Data/test/Data.PostgreSQL.Tests/ComputedExpressionProjectionTests.cs |
Standardizes the expression projection context property. |
src/HotChocolate/Data/test/Data.PostgreSQL.Tests/AsSelectorRecordProjectionTests.cs |
Standardizes the record projection context property. |
src/HotChocolate/Data/test/Data.PostgreSQL.Tests/AsSelectorEncapsulatedProjectionTests.cs |
Standardizes encapsulated projection set declarations. |
src/HotChocolate/Data/test/Data.PostgreSQL.Tests/ArrayLengthProjectionTests.cs |
Standardizes the projection context property. |
src/HotChocolate/Data/test/Data.PostgreSQL.Tests/ArrayLengthFilterTests.cs |
Standardizes the filter context property. |
src/HotChocolate/Data/test/Data.NodaTime.Tests/TestContext/BookContext.cs |
Removes null! initializers. |
src/HotChocolate/Data/test/Data.Filters.SqlServer.Tests/TestContext/CatalogContext.cs |
Removes null! initializers. |
src/HotChocolate/Data/test/Data.Filters.SqlServer.Tests/DatabaseContext.cs |
Removes the generic set initializer. |
src/HotChocolate/Data/test/Data.EntityFramework.Tests/QueryContextProjectionTests.cs |
Standardizes projection context set declarations. |
src/HotChocolate/Data/test/Data.EntityFramework.Tests/Issue8407ProbeTests.cs |
Standardizes probe context set declarations. |
src/HotChocolate/Data/test/Data.EntityFramework.Tests/Issue8252ProbeTests.cs |
Standardizes the probe context property. |
src/HotChocolate/Data/test/Data.EntityFramework.Tests/Issue5449Tests.cs |
Standardizes the test context property. |
src/HotChocolate/Data/test/Data.EntityFramework.Tests/IsProjectedSelectorTests.cs |
Standardizes the selector context property. |
src/HotChocolate/Data/test/Data.EntityFramework.Tests/InterfaceFieldProjectionTests.cs |
Standardizes the projection context property. |
src/HotChocolate/Data/test/Data.EntityFramework.Tests/InterfaceFieldFilterAndSortTests.cs |
Removes the test set initializer. |
src/HotChocolate/Data/test/Data.EntityFramework.Tests/IntegrationTests.cs |
Standardizes integration-test context properties. |
src/HotChocolate/Data/test/Data.EntityFramework.Tests/DatabaseContext.cs |
Removes the generic set initializer. |
src/HotChocolate/Data/test/Data.EntityFramework.Tests/BookContext.cs |
Removes null! initializers. |
src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/TestContext/CatalogContext.cs |
Removes null! initializers. |
src/HotChocolate/AspNetCore/benchmarks/k6/Catalog.API/Data/CatalogContext.cs |
Updates benchmark context set declarations. |
src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/TestContext/NullableTestsContext.cs |
Removes null! initializers. |
src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/TestContext/FooBarContext.cs |
Removes null! initializers. |
src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/TestContext/FileSystemContext.cs |
Standardizes file-system context set declarations. |
src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/TestContext/CatalogContext.cs |
Removes null! initializers. |
src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/TestContext/AnimalContext.cs |
Removes null! initializers. |
src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/RelativeCursorTests.cs |
Standardizes the cursor test context property. |
src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/PagingTotalCountTests.cs |
Standardizes the paging test context property. |
Review effort: Lite
This was referenced Oct 28, 2026
Open
Merged
This was referenced Nov 2, 2026
Bump HotChocolate.AspNetCore.Pipeline and HotChocolate.Fusion.AspNetCore
feddi-dev/feddi-gateway#109
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DbSetproperty in the tests, the examples, the k6 benchmark app, and the Mocha docs aspublic DbSet<T> Name { get; set; }, the form EF Core documents and scaffolds.= null!initializers from 47 properties. TheDbContextconstructor assigns settableDbSetproperties, and EF Core 7.0+ ships a diagnostic suppressor that silences CS8618 on them.=> Set<T>()properties (5 of them in the Mocha docs) with the same auto-property form, so the repo uses one declaration style.Test plan
Data.EntityFramework.Tests,Data.PostgreSQL.Tests,GreenDonut.Data.EntityFramework.Tests,Mocha.EntityFrameworkCore.Tests, andMocha.EntityFrameworkCore.Postgres.Testson net10.0: all pass.