Skip to content

Move IOperationReporter, ISnapshotModelProcessor and SnapshotModelProcessor to EFCore.Relational as public API#38408

Merged
AndriySvyryd merged 8 commits into
mainfrom
copilot/move-design-services-to-relational
Jun 18, 2026
Merged

Move IOperationReporter, ISnapshotModelProcessor and SnapshotModelProcessor to EFCore.Relational as public API#38408
AndriySvyryd merged 8 commits into
mainfrom
copilot/move-design-services-to-relational

Conversation

Copilot AI commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Relational providers reference EFCore.Relational but not EFCore.Design, so they could not derive from SnapshotModelProcessor or register a custom ISnapshotModelProcessor for provider-specific snapshot fixups. This relocates those design-time services down to EFCore.Relational and promotes them out of .Internal namespaces as documented public API.

Type moves

  • IOperationReporterMicrosoft.EntityFrameworkCore.Design (in EFCore.Relational/Design/)
  • ISnapshotModelProcessor, SnapshotModelProcessorMicrosoft.EntityFrameworkCore.Migrations (in EFCore.Relational/Migrations/)
  • Each type now has proper public-API XML documentation in place of the internal-API boilerplate.
  • Concrete OperationReporter and IOperationReportHandler stay in EFCore.Design (Design-only concerns).

Supporting changes

  • Moved the MultipleAnnotationConflict resource from DesignStrings to RelationalStrings (the processor can no longer reach DesignStrings).
  • Added #pragma warning disable EF1001 around internal Model/ModelExtensions usage, since the EF analyzer runs in EFCore.Relational (it does not in EFCore.Design).
  • Updated the linked-source path in ef.csproj and added an explicit EFCore.Relational reference to EFCore.Specification.Tests (which disables transitive references).
  • Regenerated EFCore.Relational and EFCore.Design API baselines to reflect the new public surface and the updated AddEntityFrameworkDesignTimeServices parameter type.

The default registration stays a TryAdd in DesignTimeServiceCollectionExtensions, which runs after provider design-time services — so a provider override now wins:

public class MyDesignTimeServices : IDesignTimeServices
{
    public void ConfigureDesignTimeServices(IServiceCollection services)
        => services.AddScoped<ISnapshotModelProcessor, MySnapshotModelProcessor>();
}

// where MySnapshotModelProcessor : SnapshotModelProcessor (now in EFCore.Relational)

Copilot AI and others added 3 commits June 11, 2026 01:10
…sor to EFCore.Relational

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Copilot AI changed the title [WIP] Move some Design services to Relational Move IOperationReporter, ISnapshotModelProcessor and SnapshotModelProcessor to EFCore.Relational Jun 11, 2026
Copilot AI requested a review from AndriySvyryd June 11, 2026 01:16
@AndriySvyryd AndriySvyryd requested a review from Copilot June 11, 2026 02:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR relocates key design-time migration snapshot services (IOperationReporter, ISnapshotModelProcessor, SnapshotModelProcessor) into EFCore.Relational so relational providers (which commonly reference EFCore.Relational but not EFCore.Design) can derive from/override snapshot processing for provider-specific fixups.

Changes:

  • Moved IOperationReporter and snapshot processing abstractions/implementation into EFCore.Relational (namespaces preserved to avoid churn).
  • Moved the MultipleAnnotationConflict resource from DesignStrings to RelationalStrings and updated usages/tests accordingly.
  • Updated build/test infrastructure references (linked-source path in ef.csproj, explicit EFCore.Relational reference in specification tests) and updated the migrations agent skill doc.

Reviewed changes

Copilot reviewed 7 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/EFCore.Specification.Tests/EFCore.Specification.Tests.csproj Adds explicit EFCore.Relational reference needed due to non-transitive test setup.
test/EFCore.Design.Tests/Migrations/Design/SnapshotModelProcessorTest.cs Updates expected warning message source from DesignStrings to RelationalStrings.
src/EFCore.Relational/Properties/RelationalStrings.resx Adds MultipleAnnotationConflict resource to Relational.
src/EFCore.Relational/Properties/RelationalStrings.Designer.cs Adds the strongly-typed accessor for MultipleAnnotationConflict.
src/EFCore.Relational/Migrations/Internal/SnapshotModelProcessor.cs Switches warning string source to RelationalStrings and adds EF1001 suppression where needed.
src/EFCore.Relational/Migrations/Internal/ISnapshotModelProcessor.cs Introduces the snapshot processor abstraction in Relational for provider overrides.
src/EFCore.Relational/Design/Internal/IOperationReporter.cs Introduces IOperationReporter in Relational for broader provider accessibility.
src/EFCore.Design/Properties/DesignStrings.resx Removes MultipleAnnotationConflict resource from Design.
src/EFCore.Design/Properties/DesignStrings.Designer.cs Removes the strongly-typed accessor for MultipleAnnotationConflict.
src/ef/ef.csproj Updates linked-source path for IOperationReporter to point to Relational.
.agents/skills/migrations/SKILL.md Updates internal agent documentation to reflect the new locations/registration behavior.
Files not reviewed (2)
  • src/EFCore.Design/Properties/DesignStrings.Designer.cs: Language not supported
  • src/EFCore.Relational/Properties/RelationalStrings.Designer.cs: Language not supported
Comments suppressed due to low confidence (1)

src/EFCore.Relational/Migrations/Internal/SnapshotModelProcessor.cs:7

  • using Microsoft.EntityFrameworkCore.Diagnostics; is redundant here because EFCore.Relational already provides this namespace via global <Using Include="Microsoft.EntityFrameworkCore.Diagnostics" /> in EFCore.Relational.csproj. Keeping it will typically trigger IDE0005 (unnecessary using) under analyzers.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread .agents/skills/migrations/SKILL.md Outdated
@AndriySvyryd AndriySvyryd marked this pull request as ready for review June 11, 2026 02:15
@AndriySvyryd AndriySvyryd requested a review from a team as a code owner June 11, 2026 02:15
Copilot AI review requested due to automatic review settings June 11, 2026 02:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 11 changed files in this pull request and generated no new comments.

Files not reviewed (2)
  • src/EFCore.Design/Properties/DesignStrings.Designer.cs: Language not supported
  • src/EFCore.Relational/Properties/RelationalStrings.Designer.cs: Language not supported

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Comment thread src/EFCore.Relational/Properties/RelationalStrings.Designer.cs
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot June 11, 2026 19:49
Copilot AI requested a review from AndriySvyryd June 11, 2026 19:49

@cincuranet cincuranet 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.

I would prefer to also change the namespace, but if not having usings churn is strongly preferred, it's fine with me.

@AndriySvyryd

Copy link
Copy Markdown
Member

@copilot Move IOperationReporter, ISnapshotModelProcessor and SnapshotModelProcessor out of the .Internal namespaces and document them as public API.

…Processor to public API

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot June 17, 2026 07:12

Copilot AI commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Move IOperationReporter, ISnapshotModelProcessor and SnapshotModelProcessor out of the .Internal namespaces and document them as public API.

Done in the latest commit. IOperationReporter is now in Microsoft.EntityFrameworkCore.Design, and ISnapshotModelProcessor/SnapshotModelProcessor are in Microsoft.EntityFrameworkCore.Migrations, with public-API XML docs. API baselines for EFCore.Relational and EFCore.Design were regenerated; all 14 EFCore.ApiBaseline.Tests pass and the 18 SnapshotModelProcessorTest tests still pass.

Copilot AI changed the title Move IOperationReporter, ISnapshotModelProcessor and SnapshotModelProcessor to EFCore.Relational Move IOperationReporter, ISnapshotModelProcessor and SnapshotModelProcessor to EFCore.Relational as public API Jun 17, 2026
@AndriySvyryd AndriySvyryd enabled auto-merge (squash) June 17, 2026 16:04
@AndriySvyryd AndriySvyryd requested a review from cincuranet June 17, 2026 16:52
@AndriySvyryd AndriySvyryd merged commit be40c4d into main Jun 18, 2026
14 checks passed
@AndriySvyryd AndriySvyryd deleted the copilot/move-design-services-to-relational branch June 18, 2026 08:46
@github-actions github-actions Bot added the api-review This PR or issue is introducing public API changes that need to be reviewed label Jun 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

API review baseline changes for src/EFCore.Design/EFCore.Design.baseline.json

Show diff

The diff below was generated by ApiChief between the base and the PR.

  static class Microsoft.EntityFrameworkCore.Design.DesignTimeServiceCollectionExtensions
- static IServiceCollection AddEntityFrameworkDesignTimeServices(this IServiceCollection services, IOperationReporter? reporter = null,
-     Func<IServiceProvider>? applicationServiceProviderAccessor = null);
+ static IServiceCollection AddEntityFrameworkDesignTimeServices(this IServiceCollection services, IOperationReporter? reporter = null,
+     Func<IServiceProvider>? applicationServiceProviderAccessor = null);

API review baseline changes for src/EFCore.Relational/EFCore.Relational.baseline.json

Show diff

The diff below was generated by ApiChief between the base and the PR.

+ interface Microsoft.EntityFrameworkCore.Design.IOperationReporter
+ void WriteError(string message);
+ void WriteInformation(string message);
+ void WriteVerbose(string message);
+ void WriteWarning(string message);
  static class Microsoft.EntityFrameworkCore.Diagnostics.RelationalStrings
+ static string MultipleAnnotationConflict(object? annotationName);
+ interface Microsoft.EntityFrameworkCore.Migrations.ISnapshotModelProcessor
+ IModel? Process(IReadOnlyModel? model, bool resetVersion = false);
+ class Microsoft.EntityFrameworkCore.Migrations.SnapshotModelProcessor : Microsoft.EntityFrameworkCore.Migrations.ISnapshotModelProcessor
+ virtual IModel? Process(IReadOnlyModel? model, bool resetVersion = false);
+ SnapshotModelProcessor(IOperationReporter operationReporter, IModelRuntimeInitializer modelRuntimeInitializer);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-review This PR or issue is introducing public API changes that need to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move some of the Design services to Relational

4 participants