-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
Add predicate to ExecuteUpdateAsync #42
Comments
Browsing around source code i find your implementation like this public async Task<int> ExecuteUpdateAsync<TEntity>(
Expression<Func<SetPropertyCalls<TEntity>, SetPropertyCalls<TEntity>>> setPropertyCalls,
CancellationToken cancellationToken = default)
where TEntity : class
{
int count = await _dbContext.Set<TEntity>().ExecuteUpdateAsync(setPropertyCalls, cancellationToken);
return count;
} So instead of calling public async Task<int> ExecuteUpdateAsync<TEntity>(
Expression<Func<SetPropertyCalls<TEntity>, SetPropertyCalls<TEntity>>> setPropertyCalls,
Expression<Func<TEntity, bool>>? predicate = null
CancellationToken cancellationToken = default)
where TEntity : class
{
var dbSet = _dbContext.Set<TEntity>();
if (predicate != null) dbSet = dbSet.Where(predicate);
return await dbSet.ExecuteUpdateAsync(setPropertyCalls, cancellationToken);
} Anyway, your library is already good, filter in |
@NotAsea Thank you so much for reaching out. Surely I am taking care of it. |
closing as @TanvirArjel has already had planned for it |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ExecuteUpdateAsync
of EFCore rely on the sourceIQueryable
has already been filtered byWhere
Linq, but in your version, i can not see anywhere to add filter for your repository, which mean whenever we call something likewhole record will get updated immediately, maybe you can add an predicate to your
ExecuteUpdateAsync
to let consumer supply their own filter condition just like what we can do in EFCoreThe text was updated successfully, but these errors were encountered: