-
-
Notifications
You must be signed in to change notification settings - Fork 579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support bulk operations extension methods on DbSet instead of just DbContext #361
Comments
Not particularly. |
Sorry, I don't really mean the naming of the methods - more that because I am already able to do:
But I would like to also be able to do:
Would you accept a PR to add this interface? |
Any further comment? Here's an example from EF core itself, on |
Looking into this. I'd also like to be able to access This is because we split our DataContext collections across repositories, where each Repository class has a DbSet that it performs operations (including bulk operations) on. |
Doesn't look promising. The static methods exposed by I had a go at adding a new |
Does anything here work? https://stackoverflow.com/a/50864373 |
Library already has it's method for getting DbContext. public static class IQueryableBulkExtensions
{
public static void BulkInsert<T>(this IQueryable query, IList<T> entities, BulkConfig bulkConfig = null, Action<decimal> progress = null, Type type = null) where T : class
{
var context = BatchUtil.GetDbContext(query);
context.BulkInsert(entities, bulkConfig, progress, type);
}
/ ...
} |
The standard EF Core
AddRange()
andRemoveRange()
methods are available on either theDbSet
orDbContext
classes. Is there a compelling reason to not offer both interfaces for bulk operations as well?The text was updated successfully, but these errors were encountered: