EFCore.BulkExtensions icon indicating copy to clipboard operation
EFCore.BulkExtensions copied to clipboard

Postgres BatchUpdateAsync TagWith not working

Open SirOrel opened this issue 3 years ago • 3 comments

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.

SirOrel avatar Jun 07 '22 15:06 SirOrel

TagWith is not supported.

borisdj avatar Jun 08 '22 11:06 borisdj

@borisdj will it be supported?

SirOrel avatar Jun 08 '22 11:06 SirOrel

Will try to add it, but can't put timeframe on it.

borisdj avatar Jun 08 '22 14:06 borisdj

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.

borisdj avatar Jan 24 '23 13:01 borisdj