Closed ElenaShlykova closed 3 years ago
Hello @ElenaShlykova ,
By default, we keep the current behavior depending on what is used (SqlBulkCopy
or a SqlCommand
). They act differently but we keep this the logic for backward compatibility.
However, it is possible to force it.
By operation
connection.UseBulkOptions(options => options.AutoTruncate = false).BulkInsert(list);
By specific mapping
DapperPlusManager.Entity<EntitySimple>().Table("EntitySimples").UseBulkOptions(options => options.AutoTruncate = false);
Globally
BulkOperationManager.BulkOperationBuilder = builder =>
{
builder.AutoTruncate = false;
};
Let me know if that answer correctly to your request
Best Regards,
Jon
Thanks! it works. Is there any documentation where I can find an explanation about such settings?
I don't think @ElenaShlykova ,
We will eventually re-write the documentation, but unfortunately, for now, a lot of hidden features will stay... hidden ;(
Let just hope that we find enough time soon for it!
Hello, We found an issue with bulk insert when trying to insert data that did not match the column size in the database. For example, we have an nvarchar (3) column in db and we are trying to insert text containing 5 characters. When we use Bulk Insert, no errors occur and the value in the database is truncated to 3 chars without any warning.
With pure SQL there will be an error:![image](https://user-images.githubusercontent.com/61818651/105180353-85262600-5b3b-11eb-8ada-80a542dda399.png)
We would like to receive an error when we use dapper.plus. Is it possible?