Skip to content

Add experimental ExecuteMerge / ExecuteMergeReturning - #39100

Merged
AndriySvyryd merged 26 commits into
dotnet:mainfrom
omri-klein-semperis:feature/execute-merge-4526
Nov 3, 2026
Merged

AndriySvyryd merged 26 commits into
dotnet:mainfrom
omri-klein-semperis:feature/execute-merge-4526

Conversation

@omri-klein-semperis

Copy link
Copy Markdown
Contributor

Adds experimental (EF9107) ExecuteMerge, ExecuteMergeAsync,
ExecuteMergeReturning and ExecuteMergeReturningAsync bulk operators that
insert source rows into a target table and update rows that conflict on a
declared set of columns (an "upsert"), without going through the change
tracker or SaveChanges.

  • Core: MergeBuilder / MergeUpdateSettersBuilder / MergeInsertSettersBuilder
    for Match / WhenMatched / WhenNotMatched, plus the TranslateExecuteMerge
    hook and ExecuteMergeMatch.
  • Relational: MergeExpression / MergeColumnReferenceExpression nodes, plumbed
    through QuerySqlGenerator (VisitMerge), SqlNullabilityProcessor and the
    shaped-query compiler (including a RETURNING shaper). Base VisitMerge throws;
    providers opt in.
  • SQLite: lowers to INSERT ... ON CONFLICT ... DO UPDATE/DO NOTHING with
    optional RETURNING.

Functional tests are included for SQLite (DO NOTHING / DO UPDATE, explicit and
default inserts, RETURNING sync + async, source-key matching, computed-column
exclusion).

Part of #4526


  • I've read the guidelines for contributing
  • I've posted a comment on an issue with a detailed description of how I am planning to contribute and got approval from a member of the team
  • The code builds and tests pass locally
  • Commit messages follow the required format
  • Tests for the changes have been added
  • Code follows the same patterns and style as existing code in this repo

Introduces ExecuteMerge, ExecuteMergeAsync, ExecuteMergeReturning and
ExecuteMergeReturningAsync as experimental (EF9107) bulk operators that
insert source rows into a target table and update rows that conflict on a
declared set of columns (an "upsert"), without going through the change
tracker or SaveChanges.

Core:
- MergeBuilder / MergeUpdateSettersBuilder / MergeInsertSettersBuilder for
  configuring Match, WhenMatched and WhenNotMatched clauses.
- TranslateExecuteMerge hook and ExecuteMergeMatch on
  QueryableMethodTranslatingExpressionVisitor.

Relational:
- MergeExpression / MergeColumnReferenceExpression SQL nodes, plumbed
  through QuerySqlGenerator (VisitMerge), SqlNullabilityProcessor and the
  shaped-query compiler (including a RETURNING shaper).
- Base VisitMerge throws; providers opt in by overriding it.

SQLite:
- VisitMerge lowers to INSERT ... ON CONFLICT ... DO UPDATE/DO NOTHING,
  with optional RETURNING.

Behavior:
- Match honors the source-side key selector, so matching on a differently
  named source member produces the correct conflict/insert values.
- The default (no WhenNotMatched) insert excludes computed columns.

Part of dotnet#4526
Copilot AI lite review requested due to automatic review settings September 26, 2026 15:04
@omri-klein-semperis
omri-klein-semperis requested a review from a team as a code owner September 26, 2026 15:04

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.

Copilot review overview

🟡 Changes recommended

Unresolved critical and moderate correctness, SQL generation, precompilation, trimming, and cancellation issues remain.

Review effort: Lite
Findings: 1 High severity · 2 Medium severity

Open (3)
What changed in this PR

Adds experimental EF Core ExecuteMerge/upsert APIs with relational translation, SQLite ON CONFLICT support, RETURNING, and functional tests.

Changes:

  • Adds merge configuration builders and public sync/async APIs.
  • Introduces relational merge expressions, translation, shaping, and provider hooks.
  • Implements SQLite upsert SQL generation and test coverage.
File Reviewed changes
test/​EFCore.Sqlite.FunctionalTests/​ExecuteMergeSqliteTest.cs SQLite merge functional tests
src/​Shared/​EFDiagnostics.cs Experimental diagnostic identifier
src/​EFCore/​Query/​QueryableMethodTranslatingExpressionVisitor.cs Merge method translation
src/​EFCore/​Query/​MergeUpdateSettersBuilder.cs Matched-row setters
src/​EFCore/​Query/​MergeSettersBuilder.cs Shared setter capture
src/​EFCore/​Query/​MergeInsertSettersBuilder.cs Insert setters
src/​EFCore/​Query/​MergeBuilder.cs Match and action configuration
src/​EFCore/​Query/​Internal/​NavigationExpandingExpressionVisitor.cs Merge pipeline handling
src/​EFCore/​Extensions/​EntityFrameworkQueryableExtensions.cs Public merge APIs
src/​EFCore/​EFCore.baseline.json Core API baseline
src/​EFCore.Sqlite.Core/​Query/​Internal/​SqliteQuerySqlGenerator.cs SQLite upsert SQL generation
src/​EFCore.Relational/​Query/​SqlNullabilityProcessor.cs Merge nullability handling
src/​EFCore.Relational/​Query/​SqlExpressions/​MergeExpression.cs Relational merge expression
src/​EFCore.Relational/​Query/​SqlExpressions/​MergeColumnReferenceExpression.cs Merge column references
src/​EFCore.Relational/​Query/​RelationalShapedQueryCompilingExpressionVisitor.cs Merge result shaping
src/​EFCore.Relational/​Query/​RelationalQueryableMethodTranslatingExpressionVisitor.ExecuteMerge.cs Relational merge translation
src/​EFCore.Relational/​Query/​QuerySqlGenerator.cs Provider merge-generation hook
src/​EFCore.Relational/​Properties/​RelationalStrings.resx Relational error resources
src/​EFCore.Relational/​Properties/​RelationalStrings.Designer.cs Generated resource accessors
src/​EFCore.Relational/​EFCore.Relational.baseline.json Relational API baseline
Files not reviewed (1)
  • src/EFCore.Relational/Properties/RelationalStrings.Designer.cs: Generated file

Copilot AI review requested due to automatic review settings September 27, 2026 07:02

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.

Copilot review overview

🟡 Changes recommended

A critical source-materialization defect and multiple unresolved correctness, validation, parameterization, and integration issues remain.

Review effort: Lite
Findings: 2 High severity · 2 Medium severity

Open (4)
Files not reviewed (1)
  • src/EFCore.Relational/Properties/RelationalStrings.Designer.cs: Generated file
Previously missed (1)

In code that hasn't changed since last review

Medium severity Empty WhenNotMatched generates invalid empty insert values

src/​EFCore.Relational/​Query/​RelationalQueryableMethodTranslatingExpressionVisitor.ExecuteMerge.cs:289

An empty WhenNotMatched callback leaves insertProperties empty. For a non-empty source, constructing RowValueExpression(values) then fails because row values must be non-empty; for an empty source the SQLite generator would also produce an invalid empty column list. This clause needs the same explicit empty-setter validation or a defined default-values insert semantics.

…xecuteMerge

ExecuteMerge previously didn't check for the mapping strategies and table-sharing
scenarios that ExecuteDelete/ExecuteUpdate already reject, so unsupported cases
would fail confusingly or produce incorrect SQL instead of a clear error.
…n async entry points

Mirrors the DynamicDependency annotation already on ExecuteUpdateAsync, since
ExecuteMergeAsync and ExecuteMergeReturningAsync build expression trees against
private overloads only reachable via reflection.
MergeExpression didn't implement IRelationalQuotableExpression like
DeleteExpression/UpdateExpression do, so precompiling a query with
ExecuteMerge failed with a generic "unsupported constant type" error
instead of a clear diagnostic.
… target entity

The default insert path read source-row values with the target entity's
property getter, which casts its argument to the target CLR type; this threw
InvalidCastException whenever TSource wasn't TTarget (e.g. a DTO). Build the
accessor against the actual source type's same-named member instead.

Also fix QueryRootProcessor, which didn't honor the source parameter's
[NotParameterized] attribute and rewrote it into a query root whenever the
source type wasn't a model entity, breaking ExecuteMerge's translation before
it even started for any non-entity source type.
Copilot AI review requested due to automatic review settings September 28, 2026 14:03

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.

Copilot review overview

🟡 Changes recommended

Unresolved merge translation and SQLite SQL-generation issues affect correctness and valid API scenarios.

Review effort: Lite
Findings: 2 High severity

Open (2)
Resolved since last review (4)
Files not reviewed (1)
  • src/EFCore.Relational/Properties/RelationalStrings.Designer.cs: Generated file
Previously missed (4)

In code that hasn't changed since last review

Medium severity Constant-only returning projection generates empty RETURNING clause

src/​EFCore.Relational/​Query/​RelationalQueryableMethodTranslatingExpressionVisitor.ExecuteMerge.cs:224

A valid returning selector can contain no target property, such as t => 1 or t => new { Value = 1 }. In that case projections remains empty, but the SQLite generator still appends RETURNING with no expression, yielding invalid SQL. Either translate constant-only projections or reject them during translation.

Medium severity Source member mappings incorrectly resolve against target entity

src/​EFCore.Relational/​Query/​RelationalQueryableMethodTranslatingExpressionVisitor.ExecuteMerge.cs:356

The value translator resolves every member by its name on the target entity, even when the member is rooted at the source parameter. This rejects SetProperty(t => t.Name, (t, s) => s.Code) when Code is a DTO-only member, and can bind to the wrong target column when both types contain similarly named members. Source-member references need to be mapped to the inserted target column (or explicitly diagnosed as unsupported).

Medium severity Empty matched setters generate invalid DO UPDATE SQL

src/​EFCore.Sqlite.Core/​Query/​Internal/​SqliteQuerySqlGenerator.cs:107

WhenMatched(_ => { }) produces a non-null but empty setter list. This branch then emits DO UPDATE SET with no assignments, which is invalid SQLite syntax instead of behaving as a no-op (or producing a clear validation error). Treat an empty list consistently with the omitted clause or validate it before SQL generation.

Medium severity Constant returning selectors produce invalid SQL

src/​EFCore.Sqlite.Core/​Query/​Internal/​SqliteQuerySqlGenerator.cs:130

A valid selector such as t => 1 has no target member, so BuildReturning produces an empty Returning list while this condition still emits RETURNING . SQLite rejects that statement (incomplete input), and the public method cannot return the requested constant projection. Either reject projections with no SQL projection during translation or add a valid projection/shaper for them.

@omri-klein-semperis

Copy link
Copy Markdown
Contributor Author

@dotnet-policy-service agree

…xecuteMerge inserts

Address two PR review comments: the target-shape check only rejected a
Predicate, silently ignoring Take/Skip/OrderBy/Distinct/GroupBy/Having even
though the generated MERGE always targets the whole table; and explicit
WhenNotMatched setters that omitted a match/conflict column caused that
column to be left out of the INSERT entirely, so the new row could never
actually be matched by a later merge.
Copilot AI review requested due to automatic review settings September 28, 2026 14:41
Copilot stopped reviewing on behalf of omri-klein-semperis due to an error September 28, 2026 14:41

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.

Reject matching the same column more than once, which generated invalid
ON CONFLICT SQL. Name ExecuteMergeReturning in the not-supported errors when
it's the API being called, and make the unsupported-expression error
clause-agnostic since it's also thrown for insert values.

Translate a source member referenced in WhenMatched to the "excluded" column
it was inserted into unchanged, rather than resolving it by name against the
target entity; this makes DTO-only members work and throws a clear error when
the member isn't inserted as-is. Reject returning selectors that read no
target column, which produced an empty RETURNING clause.

Also mark inlined source values as sensitive so they're redacted from logs
unless sensitive data logging is enabled, and add the missing
ExecuteMergeNotSupportedInPrecompiledQueries API baseline entry.
Copilot AI lite review requested due to automatic review settings September 30, 2026 12:59

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.

Copilot review overview

🟡 Changes recommended

Unresolved owned-table insert, empty-setter SQL, translation validation, and API-baseline issues remain.

Review effort: Lite
Findings: 1 High severity

Open (1)
Resolved since last review (5)
Files not reviewed (1)
  • src/EFCore.Relational/Properties/RelationalStrings.Designer.cs: Generated file
Previously missed (1)

In code that hasn't changed since last review

Medium severity Handle empty WhenMatched setters without empty UPDATE clauses

src/​EFCore.Sqlite.Core/​Query/​Internal/​SqliteQuerySqlGenerator.cs:111

When WhenMatched is configured with an empty setter callback, UpdateSetters is a non-null empty list, so this branch emits DO UPDATE SET with no assignments. SQLite rejects that SQL at execution time; either treat an empty clause as DO NOTHING or reject it during translation with a clear error.

The insert only populates the entity type's own properties, so complex
property columns were silently left out of not-matched inserts. Owned types
don't need a check: their auto-included navigations already fail the single
entity type check.

Also add tests covering the owned-type rejection and an empty WhenMatched,
which already translates to DO NOTHING.
Copilot AI lite review requested due to automatic review settings September 30, 2026 13:49

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.

Copilot review overview

🟡 Changes recommended

Unresolved critical target-table handling and additional translation, SQL-generation, and cancellation issues remain.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity

Open (2)
Resolved since last review (1)
Files not reviewed (1)
  • src/EFCore.Relational/Properties/RelationalStrings.Designer.cs: Generated file

Copilot AI balanced review requested due to automatic review settings October 25, 2026 07:45

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.

🔵 Needs a closer look

Target-name collisions and incomplete ownership validation can silently produce incorrect persisted data.

1 open issue
2 previously missed issues

In code that hasn't changed since last review

Medium severity Reject owned navigations when auto-inclusion is disabled

src/​EFCore.Relational/​Query/​RelationalQueryableMethodTranslatingExpressionVisitor.ExecuteMerge.cs:90

Disabling auto-inclusion with Navigation(o => o.ShipTo).AutoInclude(false) lets an owner pass the shaper check, and the table-sharing check excludes owned types. An insert can then silently omit the supplied optional owned reference's values. Reject ownership navigations explicitly and add a shared regression with auto-inclusion disabled.

Medium severity Alias merge target to avoid excluded table name collision

src/​EFCore.Sqlite.Core/​Query/​Internal/​SqliteQuerySqlGenerator.cs:69

When the target table is named excluded, SQLite resolves excluded."Name" in DO UPDATE to the existing row, so a source-based update retains the old value while reporting an affected row. Emit the target's generated alias to avoid this name collision, and add a regression for an excluded table.

1 resolved since last review
3 files not reviewed
  • src/EFCore.Relational/Properties/RelationalStrings.Designer.cs: Generated file
  • src/EFCore.Sqlite.Core/Properties/SqliteStrings.Designer.cs: Generated file
  • src/EFCore/Properties/CoreStrings.Designer.cs: Generated file

Review effort: Balanced

- Read entity-typed source rows through model metadata, so non-public properties work
- Alias the SQLite target when the table is named "excluded"
- Reject nullable-to-non-nullable casts in match, insert and update selectors
- Reject inserted source members whose type doesn't match the target property
- Assert SQL baselines for all SQLite ExecuteMerge tests and add Check_all_tests_overridden
Copilot AI balanced review requested due to automatic review settings November 2, 2026 14:59

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.

🟡 Changes recommended

Unresolved merge-validation gaps permit incompatible type assignments, retain captured instances in cached RETURNING shapers, and allow owned shared-table mappings that omit owned data when auto-includes are disabled.

3 open issues
3 files not reviewed
  • src/EFCore.Relational/Properties/RelationalStrings.Designer.cs: Generated file
  • src/EFCore.Sqlite.Core/Properties/SqliteStrings.Designer.cs: Generated file
  • src/EFCore/Properties/CoreStrings.Designer.cs: Generated file

Review effort: Balanced

…atched types

- Reject non-mappable constants (e.g. 'this') in ExecuteMergeReturning selectors, as regular projections do
- Reject WhenMatched source and target member references whose CLR type doesn't match the property
Copilot AI balanced review requested due to automatic review settings November 2, 2026 15:31

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.

🔵 Needs a closer look

Human assessment is needed to evaluate potential CLR-type validation gaps and mapped-indexer handling errors in merge insert and update paths.

1 open issue
2 resolved since last review
3 files not reviewed
  • src/EFCore.Relational/Properties/RelationalStrings.Designer.cs: Generated file
  • src/EFCore.Sqlite.Core/Properties/SqliteStrings.Designer.cs: Generated file
  • src/EFCore/Properties/CoreStrings.Designer.cs: Generated file

Review effort: Balanced

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.

🟡 Changes recommended

Parameterized merge setters can write incompatible values without runtime type validation, and nullable merge expressions violate SQL expression invariants, causing failures in Debug builds.

3 open issues
1 resolved since last review
3 files not reviewed
  • src/EFCore.Relational/Properties/RelationalStrings.Designer.cs: Generated file
  • src/EFCore.Sqlite.Core/Properties/SqliteStrings.Designer.cs: Generated file
  • src/EFCore/Properties/CoreStrings.Designer.cs: Generated file

Review effort: Balanced

…ession types

- Reject setter value parameters (e.g. from SetProperty<object>) whose runtime type doesn't match the property
- Unwrap nullable value types in MergeColumnReferenceExpression and MergeSourceMemberExpression
- Take source row parameter nullability from the source member's type
- Update the API baseline for the new exception messages
Copilot AI balanced review requested due to automatic review settings November 3, 2026 14:53

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.

🔵 Needs a closer look

Human assessment is needed to weigh unpublished correctness risks, especially a critical match-key arity mismatch that can silently alter matching behavior or cause runtime failures.

No open issues 🎉

3 resolved since last review
3 files not reviewed
  • src/EFCore.Relational/Properties/RelationalStrings.Designer.cs: Generated file
  • src/EFCore.Sqlite.Core/Properties/SqliteStrings.Designer.cs: Generated file
  • src/EFCore/Properties/CoreStrings.Designer.cs: Generated file

Review effort: Balanced

@AndriySvyryd AndriySvyryd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for your contribution!
Looking forward to the follow-ups

@AndriySvyryd AndriySvyryd changed the title Add experimental ExecuteMerge / upsert support Add experimental ExecuteMerge / ExecuteMergeReturning Nov 3, 2026
@AndriySvyryd
AndriySvyryd merged commit 767a660 into dotnet:main Nov 3, 2026
19 checks passed
@github-actions github-actions Bot added the api-review This PR or issue is introducing public API changes that need to be reviewed label Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

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.

  enum Microsoft.EntityFrameworkCore.Diagnostics.CommandSource
+ [Experimental] const Microsoft.EntityFrameworkCore.Diagnostics.CommandSource ExecuteMerge
  static class Microsoft.EntityFrameworkCore.Diagnostics.RelationalStrings
+ static string ExecuteMergeEmptyWhenNotMatched { get; }
+ static string ExecuteMergeNotSupportedByProvider { get; }
+ static string ExecuteMergeNotSupportedInPrecompiledQueries { get; }
+ static string ExecuteMergeNullSource { get; }
+ static string ExecuteMergeOnComplexQuery { get; }
+ static string ExecuteMergeOnNonEntityType { get; }
+ static string ExecuteMergeComputedMatchColumn(object? property);
+ static string ExecuteMergeDuplicateInsertProperty(object? property);
+ static string ExecuteMergeDuplicateMatchColumn(object? column);
+ static string ExecuteMergeDuplicateUpdateProperty(object? property);
+ static string ExecuteMergeGeneratedInsertProperty(object? property);
+ static string ExecuteMergeInvalidPropertySelector(object? selector);
+ static string ExecuteMergeMatchColumnInsertMismatch(object? property, object? sourceMember);
+ static string ExecuteMergeMatchColumnNotInserted(object? property);
+ static string ExecuteMergeNoPrimaryKey(object? entityType);
+ static string ExecuteMergeOnComplexProperties(object? entityType);
+ static string ExecuteMergeOnTableSplitting(object? tableName);
+ static string ExecuteMergeOnTph(object? entityType);
+ static string ExecuteMergeParameterTypeMismatch(object? valueType, object? column, object? propertyType);
+ static string ExecuteMergePropertyNotFound(object? property, object? entityType);
+ static string ExecuteMergePropertyNotMapped(object? property, object? table);
+ static string ExecuteMergeReturningUnsupportedExpression(object? expression);
+ static string ExecuteMergeReturningUnsupportedSelector(object? selector);
+ static string ExecuteMergeSourceMemberConverterMismatch(object? member, object? property);
+ static string ExecuteMergeSourceMemberNotInserted(object? member);
+ static string ExecuteMergeSourceMemberTypeMismatch(object? member, object? memberType, object? property, object? propertyType);
+ static string ExecuteMergeTargetPropertyConverterMismatch(object? targetProperty, object? property);
+ static string ExecuteMergeUnsupportedExpression(object? expression);
+ static string ExecuteMergeUpdateValueTypeMismatch(object? value, object? valueType, object? property, object? propertyType);
  class Microsoft.EntityFrameworkCore.Query.QuerySqlGenerator : System.Linq.Expressions.ExpressionVisitor
+ [Experimental] virtual void VisitMerge(MergeExpression mergeExpression);
+ [Experimental] sealed class Microsoft.EntityFrameworkCore.Query.SqlExpressions.MergeColumnReferenceExpression :
+     Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression
+ [Experimental] string ColumnName { get; }
+ [Experimental] bool FromExcluded { get; }
+ [Experimental] MergeColumnReferenceExpression(string columnName, bool fromExcluded, Type type, RelationalTypeMapping? typeMapping);
+ [Experimental] sealed record Microsoft.EntityFrameworkCore.Query.SqlExpressions.MergeColumnSetter(string ColumnName, SqlExpression Value)
+ [Experimental] string ColumnName { get; init; }
+ [Experimental] SqlExpression Value { get; init; }
+ [Experimental] static bool operator !=(MergeColumnSetter? left, MergeColumnSetter? right);
+ [Experimental] MergeColumnSetter <Clone>$();
+ [Experimental] static bool operator ==(MergeColumnSetter? left, MergeColumnSetter? right);
+ [Experimental] void Deconstruct(out string ColumnName, out SqlExpression Value);
+ [Experimental] bool Equals(MergeColumnSetter? other);
+ [Experimental] MergeColumnSetter(string ColumnName, SqlExpression Value);
+ [Experimental] sealed class Microsoft.EntityFrameworkCore.Query.SqlExpressions.MergeExpression : System.Linq.Expressions.Expression,
+     Microsoft.EntityFrameworkCore.Query.IRelationalQuotableExpression, Microsoft.EntityFrameworkCore.Query.IPrintableExpression
+ [Experimental] IReadOnlyList<string> ConflictColumns { get; }
+ [Experimental] IReadOnlyList<string> InsertColumns { get; }
+ [Experimental] IReadOnlyList<ProjectionExpression>? Returning { get; }
+ [Experimental] LambdaExpression? ReturningShaper { get; }
+ [Experimental] string? SourceParameterName { get; }
+ [Experimental] IReadOnlyList<RowValueExpression> SourceRows { get; }
+ [Experimental] TableExpression Table { get; }
+ [Experimental] ISet<string> Tags { get; }
+ [Experimental] IReadOnlyList<MergeColumnSetter>? UpdateSetters { get; }
+ [Experimental] MergeExpression ApplyTags(ISet<string> tags);
+ [Experimental] MergeExpression(TableExpression table, IReadOnlyList<string> insertColumns, IReadOnlyList<RowValueExpression> sourceRows,
+     IReadOnlyList<string> conflictColumns, IReadOnlyList<MergeColumnSetter>? updateSetters, IReadOnlyList<ProjectionExpression>? returning,
+     LambdaExpression? returningShaper = null, string? sourceParameterName = null);
+ [Experimental] void Print(ExpressionPrinter expressionPrinter);
+ [Experimental] Expression Quote();
+ [Experimental] MergeExpression WithSourceRows(IReadOnlyList<RowValueExpression> sourceRows);
+ [Experimental] sealed class Microsoft.EntityFrameworkCore.Query.SqlExpressions.MergeSourceMemberExpression :
+     Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression
+ [Experimental] MemberInfo Member { get; }
+ [Experimental] object? GetValue(object? row);
+ [Experimental] MergeSourceMemberExpression(MemberInfo member, Type type, RelationalTypeMapping? typeMapping);
  class Microsoft.EntityFrameworkCore.Query.SqlNullabilityProcessor : System.Linq.Expressions.ExpressionVisitor
+ [Experimental] virtual SqlExpression VisitMergeColumnReference(MergeColumnReferenceExpression mergeColumnReferenceExpression, out bool nullable);

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

Show diff

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

  static class Microsoft.EntityFrameworkCore.Diagnostics.CoreStrings
+ static string ExecuteMergeEmptyMatch { get; }
+ static string ExecuteMergeQuerySource { get; }
+ static string ExecuteMergeDuplicateClause(object? method);
  static class Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions
+ [Experimental] static IAsyncEnumerable<TResult> ExecuteMergeReturningAsync<TTarget, TSource, TResult>(this IQueryable<TTarget> target,
+     IEnumerable<TSource> source, Action<MergeBuilder<TTarget, TSource>> buildMerge, Expression<Func<TTarget, TResult>> returning,
+     CancellationToken cancellationToken = default(System.Threading.CancellationToken));
+ [Experimental] static IEnumerable<TResult> ExecuteMergeReturning<TTarget, TSource, TResult>(this IQueryable<TTarget> target, IEnumerable<TSource> source,
+     Action<MergeBuilder<TTarget, TSource>> buildMerge, Expression<Func<TTarget, TResult>> returning);
+ [Experimental] static Task<int> ExecuteMergeAsync<TTarget, TSource>(this IQueryable<TTarget> target, IEnumerable<TSource> source, Action<MergeBuilder<TTarget,
+     TSource>> buildMerge, CancellationToken cancellationToken = default(System.Threading.CancellationToken));
+ [Experimental] static int ExecuteMerge<TTarget, TSource>(this IQueryable<TTarget> target, IEnumerable<TSource> source, Action<MergeBuilder<TTarget,
+     TSource>> buildMerge);
+ [Experimental] class Microsoft.EntityFrameworkCore.Query.MergeBuilder<TTarget, TSource>
+ [Experimental] virtual MergeBuilder<TTarget, TSource> Match<TKey>(Expression<Func<TTarget, TKey>> targetKey, Expression<Func<TSource, TKey>> sourceKey);
+ [Experimental] virtual MergeBuilder<TTarget, TSource> WhenMatched(Action<MergeUpdateSettersBuilder<TTarget, TSource>> setPropertyCalls);
+ [Experimental] virtual MergeBuilder<TTarget, TSource> WhenNotMatched(Action<MergeInsertSettersBuilder<TTarget, TSource>> setPropertyCalls);
+ [Experimental] sealed class Microsoft.EntityFrameworkCore.Query.MergeInsertSettersBuilder<TTarget,
+     TSource> : Microsoft.EntityFrameworkCore.Query.MergeSettersBuilder
+ [Experimental] MergeInsertSettersBuilder<TTarget, TSource> SetProperty<TProperty>(Expression<Func<TTarget, TProperty>> propertyExpression,
+     Expression<Func<TSource, TProperty>> valueExpression);
+ [Experimental] MergeInsertSettersBuilder<TTarget, TSource> SetProperty<TProperty>(Expression<Func<TTarget, TProperty>> propertyExpression,
+     TProperty valueExpression);
+ [Experimental] abstract class Microsoft.EntityFrameworkCore.Query.MergeSettersBuilder
+ [Experimental] MergeSettersBuilder();
+ [Experimental] sealed class Microsoft.EntityFrameworkCore.Query.MergeUpdateSettersBuilder<TTarget,
+     TSource> : Microsoft.EntityFrameworkCore.Query.MergeSettersBuilder
+ [Experimental] MergeUpdateSettersBuilder<TTarget, TSource> SetProperty<TProperty>(Expression<Func<TTarget, TProperty>> propertyExpression,
+     Expression<Func<TTarget, TSource, TProperty>> valueExpression);
+ [Experimental] MergeUpdateSettersBuilder<TTarget, TSource> SetProperty<TProperty>(Expression<Func<TTarget, TProperty>> propertyExpression,
+     TProperty valueExpression);
+ [Experimental] sealed record Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.ExecuteMergeMatch
+ [Experimental] LambdaExpression SourceKeySelector { get; init; }
+ [Experimental] LambdaExpression TargetKeySelector { get; init; }
+ [Experimental] static bool operator !=(ExecuteMergeMatch? left, ExecuteMergeMatch? right);
+ [Experimental] ExecuteMergeMatch <Clone>$();
+ [Experimental] static bool operator ==(ExecuteMergeMatch? left, ExecuteMergeMatch? right);
+ [Experimental] void Deconstruct(out LambdaExpression TargetKeySelector, out LambdaExpression SourceKeySelector);
+ [Experimental] bool Equals(ExecuteMergeMatch? other);
+ [Experimental] ExecuteMergeMatch(LambdaExpression TargetKeySelector, LambdaExpression SourceKeySelector);
  abstract class Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor : System.Linq.Expressions.ExpressionVisitor
+ [Experimental] virtual Expression TranslateExecuteMerge(ShapedQueryExpression source, QueryParameterExpression sourceRows,
+     IReadOnlyList<ExecuteMergeMatch> matches, IReadOnlyList<ExecuteUpdateSetter>? whenMatchedSetters,
+     IReadOnlyList<ExecuteUpdateSetter>? whenNotMatchedSetters, LambdaExpression? returningSelector);

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 community-contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants