Skip to content

BulkMergeAsync ignores columns with default values in generated INSERT #813

Open
@bengavin

Description

1. Description

When generating the MERGE statement, columns which have an EFCore fluent configured default value are ignored when generating the INSERT portion of the SQL statement. They are included in the staging table and in the UPDATE portion of the statement.

2. Exception

N/A

3. Fiddle or Project

Not available at this time, I may have time to put one together later.

4. Any further technical details

Removing the 'HasDefaultValue(...)' configuration on the properties restores the expected behavior. I would expect that, if a database default value was to be returned, it would only be used/returned in the case where the source property on the entity being saved was NULL.

NOTE: This behavior does -not- happen when using BulkSaveChangesAsync

Further technical details

  • EF version: [EF Core v8.0.10]
  • EF Plus version: [EF Plus Core v8.103.4]
  • Database Server version: [Azure SQL Server]
  • Database Provider version (NuGet): [Microsoft.Data.SqlClient v5.1.2]

Activity

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

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions