Skip to content

Feat/design time#2

Merged
cliedeman merged 14 commits into
mainfrom
feat/design-time
Feb 21, 2026
Merged

Feat/design time#2
cliedeman merged 14 commits into
mainfrom
feat/design-time

Conversation

@cliedeman

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds EF Core design-time integration to automatically generate GraphQL DataLoader sidecar files during migrations scaffolding, and updates the generator output to better match GraphQL conventions (ignored FK scalar fields, improved notes/docs).

Changes:

  • Introduce a new Stackworx.EfCoreGraphQL.DesignTime project with an IMigrationsCodeGenerator that generates {Snapshot}.DataLoaders.g.cs + a hash sidecar.
  • Update core generator to support design-time (string generation from IModel, pass DbContext type instead of instance) and emit ExtendObjectType(... IgnoreFields = ...) for redundant FK scalar fields.
  • Enhance many-to-many generation with explicit XML doc notes and update tests/sample outputs accordingly.

Reviewed changes

Copilot reviewed 34 out of 37 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/Stackworx.EfCoreGraphQL.Tests/Tests.cs Updates expectations/calls to pass DbContext type and compare entity type as string.
src/Stackworx.EfCoreGraphQL/TypeUtils.cs Adds ToGraphQlFieldName helper for camelCase conversion.
src/Stackworx.EfCoreGraphQL/Stackworx.EfCoreGraphQL.csproj Bumps package version to 0.0.12-alpha.
src/Stackworx.EfCoreGraphQL/ManyToMany.cs Adds loader/field notes and emits XML doc summaries for generated methods.
src/Stackworx.EfCoreGraphQL/Generate.cs Adds GenerateString for design-time generation and emits IgnoreFields for FK scalars.
src/Stackworx.EfCoreGraphQL/ForeignKeyIgnoreFields.cs New helper to compute redundant FK scalar GraphQL field names to ignore.
src/Stackworx.EfCoreGraphQL/FieldExtension.cs Changes APIs to accept DbContext type instead of instance.
src/Stackworx.EfCoreGraphQL/DataLoader.cs Changes EntityType from Type to string and updates emitter + factory signatures.
src/Stackworx.EFCoreGraphQL.DesignTime/Stackworx.EfCoreGraphQL.DesignTime.csproj New design-time package project definition.
src/Stackworx.EFCoreGraphQL.DesignTime/README.md Adds design-time integration sample instructions.
src/Stackworx.EFCoreGraphQL.DesignTime/EfCoreMigrationsCodeGenerator.cs New migrations generator writing sidecar + hash files.
sample/Sample/Sample.csproj Updates EF Core packages and removes direct project reference to generator lib.
sample/Sample/DataLoaders.g.cs Updates generated output (IgnoreFields + many-to-many XML docs).
sample/Sample.Generate/Sample.Generate.csproj Adds reference to generator library for the console generation app.
sample/Sample.DesignTime/appsettings.json New design-time sample app configuration.
sample/Sample.DesignTime/WebApplicationExtensions.cs Adds seeding for design-time sample app.
sample/Sample.DesignTime/Types/Query.cs Adds GraphQL query types for design-time sample app.
sample/Sample.DesignTime/Sample.DesignTime.csproj New sample app wiring the design-time package.
sample/Sample.DesignTime/Properties/launchSettings.json New run profile for design-time sample app.
sample/Sample.DesignTime/Program.cs New design-time sample app host setup.
sample/Sample.DesignTime/Migrations/AppDbContextModelSnapshot.cs New snapshot for design-time sample.
sample/Sample.DesignTime/Migrations/AppDbContextModelSnapshot.DataLoaders.g.hash New hash file tracking snapshot changes.
sample/Sample.DesignTime/Migrations/AppDbContextModelSnapshot.DataLoaders.g.cs New generated DataLoaders sidecar file.
sample/Sample.DesignTime/Migrations/20260221162418_InitialCreate.cs Adds an (empty) migration in the sample.
sample/Sample.DesignTime/Migrations/20260221162418_InitialCreate.Designer.cs Designer for the empty migration.
sample/Sample.DesignTime/Migrations/20260221160640_Initial.cs Adds initial schema migration for the sample.
sample/Sample.DesignTime/Migrations/20260221160640_Initial.Designer.cs Designer for the initial schema migration.
sample/Sample.DesignTime/DesignTimeServices.cs Registers the custom migrations code generator for EF tooling discovery.
sample/Sample.DesignTime/Data/Book.cs Sample entity.
sample/Sample.DesignTime/Data/Author.cs Sample entity.
sample/Sample.DesignTime/Data/AppDbContextFactory.cs Design-time DbContext factory for EF tools.
sample/Sample.DesignTime/Data/AppDbContext.cs Sample DbContext model setup.
sample/Sample.DesignTime/.gitignore Ignores local db folder.
dotnet-tools.json Bumps dotnet-ef tool version.
Stackworx.EfCoreGraphQL.slnx Adds new projects and normalizes solution entries.
README.md Documents how to use the design-time integration.
Files not reviewed (2)
  • sample/Sample.DesignTime/Migrations/20260221160640_Initial.Designer.cs: Language not supported
  • sample/Sample.DesignTime/Migrations/20260221162418_InitialCreate.Designer.cs: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Stackworx.EFCoreGraphQL.DesignTime/EfCoreMigrationsCodeGenerator.cs Outdated
Comment thread src/Stackworx.EFCoreGraphQL.DesignTime/EfCoreMigrationsCodeGenerator.cs Outdated
Comment thread src/Stackworx.EFCoreGraphQL.DesignTime/Stackworx.EfCoreGraphQL.DesignTime.csproj Outdated
Comment thread src/Stackworx.EfCoreGraphQL/Generate.cs Outdated
Comment on lines +174 to +177
// Design-time generation doesn't have a DbContext instance.
// The emitters currently only need entity metadata, so we can safely pass null.
// (Any future DbContext usage should be guarded.)
Generate(contextType, entity, sb, version);

Copilot AI Feb 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says design-time generation can “safely pass null”, but the code now passes contextType into Generate(...). Update/remove the comment so it matches the current implementation and doesn’t suggest null is expected/allowed.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Comment thread sample/Sample.DesignTime/Migrations/20260221162418_InitialCreate.cs
cliedeman and others added 4 commits February 21, 2026 18:39
…erator.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…erator.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
….DesignTime.csproj

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Copilot AI commented Feb 21, 2026

Copy link
Copy Markdown
Contributor

@cliedeman I've opened a new pull request, #3, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits February 21, 2026 16:40
…ed directly

Co-authored-by: cliedeman <3578740+cliedeman@users.noreply.github.com>
Remove stale comment misrepresenting null usage in Generate.cs
@cliedeman
cliedeman merged commit 997717c into main Feb 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants