EFCore.BulkExtensions
EFCore.BulkExtensions copied to clipboard
Postgres BatchUpdateAsync TagWith not working
Executing such update triggers an exception:
await _DbContext.Users.TagWith("My tag").Where(user => user.Id == userId).BatchUpdateAsync(user => new User { LastLoginDate = DateTime.UtcNow });
System.ArgumentOutOfRangeException: Length cannot be less
than zero. (Parameter 'length')
at System.String.Substring(Int32 startIndex, Int32 length)
at EFCore.BulkExtensions.SQLAdapters.PostgreSql.SqlQueryBuilderPostgreSql.RestructureForBatch(String sql, Boolean isDelete)
at EFCore.BulkExtensions.BatchUtil.GetSqlUpdate[T](IQueryable`1 query, DbContext context, Type type, Expression`1 expression)
at EFCore.BulkExtensions.IQueryableBatchExtensions.GetBatchUpdateArguments[T](IQueryable`1 query, Object updateValues, List`1 updateColumns, Expression`1 updateExpression, Type type)
at EFCore.BulkExtensions.IQueryableBatchExtensions.BatchUpdateAsync[T](IQueryable`1 query, Expression`1 updateExpression, Type type, CancellationToken cancellationToken)
Without TagWith everything works fine.
TagWith is not supported.
@borisdj will it be supported?
Will try to add it, but can't put timeframe on it.
Since Batch ops as of EF7 are now natively supported with ExecuteUpdate/ExecuteDelete, Batch extensions will become Deprecated here. Focus is only on BULK methods which is the main purpose of the lib.