Skip to content

feat: support generating compiled models#685

Merged
olavloite merged 4 commits intomainfrom
issue-680
Feb 18, 2026
Merged

feat: support generating compiled models#685
olavloite merged 4 commits intomainfrom
issue-680

Conversation

@olavloite
Copy link
Collaborator

@olavloite olavloite commented Feb 10, 2026

Modifies type mappings so these work with design-time services for generating a compiled model.

Note that dotnet/efcore#36437 also applies here, so while generating a compiled model works, the tool still reports an error, as the report step afterwards fails for Entity Framework 8.

Fixes #680

@gemini-code-assist
Copy link

Summary of Changes

Hello @olavloite, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request modifies the type mappings in the Google Cloud Entity Framework Core Spanner provider to support design-time services for generating compiled models. It also adds annotations to internal APIs and defines default type mapping instances.

Highlights

  • Type Mappings: Modified type mappings to work with design-time services for generating a compiled model.
  • Internal API Annotations: Added annotations to several classes indicating they are internal APIs and not subject to compatibility standards.
  • Default Type Mappings: Added default instances for various Spanner type mappings.
Changelog
  • Google.Cloud.EntityFrameworkCore.Spanner.Samples/Google.Cloud.EntityFrameworkCore.Spanner.Samples.csproj
    • Added RollForward property to the project file.
  • Google.Cloud.EntityFrameworkCore.Spanner/Storage/Internal/SpannerBoolTypeMapping.cs
    • Changed SpannerBoolTypeMapping to public, added an internal API annotation, and added a default instance.
  • Google.Cloud.EntityFrameworkCore.Spanner/Storage/Internal/SpannerComplexTypeMapping.cs
    • Changed SpannerComplexTypeMapping to public, added a default instance, and ensured array types are initialized correctly.
  • Google.Cloud.EntityFrameworkCore.Spanner/Storage/Internal/SpannerDateTypeMapping.cs
    • Changed SpannerDateTypeMapping to public, added an internal API annotation, and added a default instance.
  • Google.Cloud.EntityFrameworkCore.Spanner/Storage/Internal/SpannerDecimalTypeMapping.cs
    • Changed SpannerDecimalTypeMapping to public, added an internal API annotation, and added a default instance.
  • Google.Cloud.EntityFrameworkCore.Spanner/Storage/Internal/SpannerDoubleTypeMapping.cs
    • Changed SpannerDoubleTypeMapping to public, added an internal API annotation, and added a default instance.
  • Google.Cloud.EntityFrameworkCore.Spanner/Storage/Internal/SpannerFloatTypeMapping.cs
    • Changed SpannerFloatTypeMapping to public, added an internal API annotation, and added a default instance.
  • Google.Cloud.EntityFrameworkCore.Spanner/Storage/Internal/SpannerGuidTypeMapping.cs
    • Changed SpannerGuidTypeMapping to public, added an internal API annotation, and added a default instance.
  • Google.Cloud.EntityFrameworkCore.Spanner/Storage/Internal/SpannerJsonArrayTypeMapping.cs
    • Changed SpannerJsonArrayTypeMapping to public, added an internal API annotation, and added a default instance.
  • Google.Cloud.EntityFrameworkCore.Spanner/Storage/Internal/SpannerJsonListTypeMapping.cs
    • Changed SpannerJsonListTypeMapping to public, added an internal API annotation, and added a default instance.
  • Google.Cloud.EntityFrameworkCore.Spanner/Storage/Internal/SpannerJsonTypeMapping.cs
    • Changed SpannerJsonTypeMapping to public, added an internal API annotation, and added a default instance.
  • Google.Cloud.EntityFrameworkCore.Spanner/Storage/Internal/SpannerNullableDateArrayTypeMapping.cs
    • Changed SpannerNullableDateArrayTypeMapping to public, added an internal API annotation, and added a default instance.
  • Google.Cloud.EntityFrameworkCore.Spanner/Storage/Internal/SpannerNullableDateListTypeMapping.cs
    • Changed SpannerNullableDateListTypeMapping to public, added an internal API annotation, and added a default instance.
  • Google.Cloud.EntityFrameworkCore.Spanner/Storage/Internal/SpannerNumericTypeMapping.cs
    • Changed SpannerNumericTypeMapping to public, added an internal API annotation, and added a default instance.
  • Google.Cloud.EntityFrameworkCore.Spanner/Storage/Internal/SpannerStringTypeMapping.cs
    • Changed SpannerStringTypeMapping to public, added an internal API annotation, and added a default instance.
  • Google.Cloud.EntityFrameworkCore.Spanner/Storage/Internal/SpannerStructuralJsonTypeMapping.cs
    • Changed SpannerStructuralJsonTypeMapping to public and added an internal API annotation.
  • Google.Cloud.EntityFrameworkCore.Spanner/Storage/Internal/SpannerTimestampTypeMapping.cs
    • Changed SpannerTimestampTypeMapping to public, added an internal API annotation, and added a default instance.
  • Google.Cloud.EntityFrameworkCore.Spanner/Storage/Internal/SpannerTypeMappingSource.cs
    • Removed unused namespace import and corrected a typo in a variable name.
Activity
  • The pull request modifies type mappings to support design-time services for generating a compiled model.
  • Several classes were made public and annotated as internal APIs.
  • Default instances were added for various Spanner type mappings.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request primarily updates various type mapping classes to support Entity Framework Core's compiled models feature. The changes involve making internal classes public, adding static Default properties, and including standard XML documentation to warn about their internal nature. These modifications are necessary and correctly implemented for enabling design-time services. I have one suggestion to improve code clarity and potentially avoid a minor inefficiency in SpannerComplexTypeMapping.cs by removing a redundant null check, aligning with repository guidelines.

@olavloite olavloite force-pushed the issue-680 branch 6 times, most recently from 77702ad to db82d79 Compare February 10, 2026 19:52
@olavloite olavloite marked this pull request as ready for review February 10, 2026 19:58
@olavloite olavloite requested a review from rahul2393 February 10, 2026 19:58
- name: Compile sample model
working-directory: ./Google.Cloud.EntityFrameworkCore.Spanner.Samples
run: |
dotnet tool install --global dotnet-ef
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: should we pin the version here for dotnet-ef?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, I think that it is better to install the latest, so we automatically get a signal if the newest version fails this. (I'm not sure if the dependency bots would pick up a version number here, meaning that we would risk getting stuck at an old version for a long time)

@olavloite olavloite merged commit 02f7648 into main Feb 18, 2026
17 checks passed
@olavloite olavloite deleted the issue-680 branch February 18, 2026 08:14
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.

dotnet ef dbcontext optimize fails: TypeMappings missing Default property

2 participants