-
-
Notifications
You must be signed in to change notification settings - Fork 580
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
Create extension method #56
Comments
BulkOps are not calling public static class MyContextBulkExtensions
{
public static Task BulkInsertAsync<T>(this CoreContext context, IList<T> entities, BulkConfig bulkConfig = null, Action<decimal> progress = null) where T : class
{
context.SetAuditInfo<T>(entities);
return ((DbContext)context).BulkInsertAsync(entities, bulkConfig, progress);
}
public static Task BulkUpdateAsync<T>(this CoreContext context, IList<T> entities, IList<T> previousEntities, BulkConfig bulkConfig = null, Action<decimal> progress = null) where T : class
{
context.SetAuditInfo<T>(entities, previousEntities);
return ((DbContext)context).BulkUpdateAsync(entities, bulkConfig, progress);
}
} SaveChanges that is called when regular EF is used, has it's own logic for setting AuditInfo. |
Hi Borisdj Thank you for your information. With those statics i can set the properties i want to set before the items get saved to the database. The change tracking in EF is indeed a problem that's why i started using EFCore.BulkExtensions. |
I'm trying to create an override for the BulkInsert function. In my dbcontext I use an override on SaveChanges() where i edit several properties of the object and return the base.SaveChanges();
Is it possible to create this for the bulklinsert?
The text was updated successfully, but these errors were encountered: