zzzprojects / Dapper-Plus

Dapper Plus - High-Efficient Bulk Actions (Insert, Update, Delete, and Merge) for .NET
https://dapper-plus.net/
383 stars 85 forks source link

Applying wrong config for bulk operation? #63

Closed jurakovic closed 4 years ago

jurakovic commented 4 years ago

I was just wandering around and saw this In Z.Dapper.Plus\DapperPlusAction\Method\Execute.cs _configInsert is used for each DapperPlusActionKind, instead of just for .Insert? Not sure if intended or not, but since names mismatch and config indeed has different configs for different operations, it smells to me

if (Kind == DapperPlusActionKind.Insert)
{
    ApplyConfig(bulkOperation, config._configInsert);
    bulkOperation.BulkInsert();
}
else if (Kind == DapperPlusActionKind.Update)
{
    ApplyConfig(bulkOperation, config._configInsert);
    bulkOperation.BulkUpdate();
}
else if (Kind == DapperPlusActionKind.Delete)
{
    ApplyConfig(bulkOperation, config._configInsert);
    bulkOperation.BulkDelete();
}
else if (Kind == DapperPlusActionKind.Merge)
{
    ApplyConfig(bulkOperation, config._configInsert);
    bulkOperation.BulkMerge();
}

Regards

JonathanMagnan commented 4 years ago

Hello @jurakovic ,

Unfortunately, this logic as never been completed. We cannot still make different configurations depending on the operations.

The major problem to complete this feature is being backward compatible. We are afraid that if we do it, we will break some people's code and no one want this! That's pretty much why we left it like this.

Keep in mind that the code in this GitHub has never been updated. The source is in our private repository.

Best Regards,

Jon

jurakovic commented 4 years ago

I understand. Thank you for explanation. I'm closing an issue then.

Best regards J