-
Notifications
You must be signed in to change notification settings - Fork 88
Description
Hello there!
Trying to execute BulkUpdate action but getting the following error:
fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
An unhandled exception has occurred while executing the request.
System.Exception: An error occured while retrieving the InformationSchemaTable information. See the inner exception for details.
---> System.ArgumentNullException: Value cannot be null. (Parameter 'key')
at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at System.Collections.Generic.Dictionary
2.Add(TKey key, TValue value)
at System.Linq.Enumerable.ToDictionary[TSource,TKey](List1 source, Func
2 keySelector, IEqualityComparer1 comparer) at System.Linq.Enumerable.ToDictionary[TSource,TKey](IEnumerable
1 source, Func2 keySelector, IEqualityComparer
1 comparer)
at .(Boolean , String[] )
at .()
at Z.BulkOperations.BulkOperation.()
--- End of inner exception stack trace ---
at Z.BulkOperations.BulkOperation.()
at Z.BulkOperations.BulkOperation.Execute()
at Z.BulkOperations.BulkOperation.BulkUpdate()
at Z.Dapper.Plus.DapperPlusAction.Execute()
at Z.Dapper.Plus.DapperPlusActionSet1.AddAction(String mapperKey, DapperPlusActionKind actionKind, TEntity item) at Z.Dapper.Plus.DapperPlusActionSet
1.DapperPlusActionSetBuilder(DapperPlusContext context, IDbConnection connection, IDbTransaction transaction, String mapperKey, DapperPlusActionKind actionKind, TEntity item, Func2[] selectors) at Z.Dapper.Plus.DapperPlusActionSet
1..ctor(DapperPlusContext context, IDbConnection connection, String mapperKey, DapperPlusActionKind actionKind, TEntity item, Func2[] selectors) at Z.Dapper.Plus.DapperPlusExtensions.BulkUpdate[T](IDbConnection connection, String mapperKey, T item, Func
2[] selectors)
at Z.Dapper.Plus.DapperPlusExtensions.BulkUpdate[T](IDbConnection connection, T item, Func`2[] selectors)
The method
public async Task<bool> BulkUpdateAsync(List<ProductItemStock> productItemStocks)
{
DapperPlusManager.Entity<ProductItemStock>().Table("ProductItemStocks").Identity(q => q.Id).Ignore(q => q.StoragePath);
using (var connection = await _postgreSQLDbConnectionFactory.CreateAsync())
{
connection.BulkUpdate(productItemStocks);
}
return true;
}
Details of object
public abstract class _Domain<TKey> : IDomain<TKey>
{
public TKey Id { get; set; }
public bool IsDeleted { get; set; }
}
public class ProductItemStock : _Domain<int>
{
public ProductItemStock() { }
public ProductItemStock(int productItemId, int storagePathId, int stock)
{
this.ProductItemId = productItemId;
this.StoragePathId = storagePathId;
this.Stock = stock;
}
public int ProductItemId { get; set; }
public int StoragePathId { get; set; }
public int Stock { get; set; }
public int ReservedStock { get; set; }
public StoragePath StoragePath { get; set; }
}
I tried the update action with Dapper.Contrib and was able to successfully update.
The object values:
Packages which I using:
Z.Dapper.Plus version 4.0.9
Npgsql version 5.0.7