Open malakrsnaslava opened 1 month ago
I have tested this scenario with the framework, and I was not able to reproduce your issue.
I did some research on this and since you have defined the default for a property, that would make SQL Server responsible for setting the default value upon inserting data into the table. The column would not be included in the temporary table or in the subsequent Merge statement.
Describe the bug The BulkInsert method is not inserting boolean (bool) values when they have a default value specified in the model.
To Reproduce Steps to reproduce the behavior:
In your model definition, set a default value for a bool property like this:
Insert entities in bulk using:
N.EntityFrameworkCore.Extensions.DbContextExtensions.BulkInsert(dbx, listForInsert);
The boolean property (SomeBool) is not being inserted with its value, even though the default is set in the model.I used SQL Profiler to track the SQL queries, and the mentioned bool column does not appear in the generated SQL for the bulk insert. All other columns are present in the temporary table that the framework creates (e.g., #tmp_be_xx_TABLE), but the that boolean field is missing.
Expected behavior The BulkInsert operation should insert the boolean property value, even if a default value is specified in the model.
Environment: Library Version: 8.0.0.11 Database: SQL Server 2019 .NET Version: .NET 8.0.8 This behavior has been tested on multiple SQL Server instances with the same result.