linq2db.EntityFrameworkCore icon indicating copy to clipboard operation
linq2db.EntityFrameworkCore copied to clipboard

Setting `BulkCopyOptions`

Open AntonC9018 opened this issue 1 year ago • 5 comments

There doesn't seem to be a way to set BulkCopyTimeout for example, on the whole context, rather than per operation, non-globally. The only way to configure it seems to be setting a value for LinqToDBOptionsExtension on EF Core's IDbContextOptions, which seems to be the responsibility of UseLinqToDB. Anyway, I suggest adding a configuration parameter to CreateLinqToDbContext for DataOptions to make configuration like that possible.

AntonC9018 avatar Nov 12 '23 13:11 AntonC9018

DataOptions already support bulk copy settings:

dataOptions.UseBulkCopyTimeout(123);
// or
dataOptions.BulkCopyOptions.WithBulkCopyTimeout(123);

MaceWindu avatar Nov 15 '23 11:11 MaceWindu

DataOptions already support bulk copy settings:

dataOptions.UseBulkCopyTimeout(123);
// or
dataOptions.BulkCopyOptions.WithBulkCopyTimeout(123);

Well yeah, but that doesn't actually change it. You have to reassign the options after. And you can't reassign it for IDataContext.

Those methods are pure.

AntonC9018 avatar Nov 15 '23 11:11 AntonC9018

You are not supposed to re-assign it. Check AddCustomOptions configuration extension example in readme

MaceWindu avatar Nov 15 '23 11:11 MaceWindu

You are not supposed to re-assign it. Check AddCustomOptions configuration extension example in readme

Like I mentioned, that's global, aka per context type. It doesn't allow configuring it per context instance. That's what I said in this issue.

AntonC9018 avatar Nov 15 '23 11:11 AntonC9018

I see, we can add configuration delegete parameter to CreateLinqToDbContext APIs

MaceWindu avatar Nov 15 '23 11:11 MaceWindu