You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vardbContext= GetDbContext();await dbContext.Database.EnsureDeletedAsync();await dbContext.Database.EnsureCreatedAsync();vartagsToSave=newList<Tag>(){new(){Name="Tag1",AuditingInfo=new AuditingInfo("A", DateTimeOffset.Now,"B", DateTimeOffset.Now)}};varbulkConfig=new BulkConfig
{UseTempDB=true,BulkCopyTimeout=0,UpdateByProperties=newList<string>{// When we used owned properties, we left out nameof(Tag.AuditingInfo)// When I now leave out nameof(Tag.AuditingInfo), we get the error "Cannot insert the value NULL into column 'AuditingInfo_CreatedAt'"// When we specify nameof(Tag.AuditingInfo) we get the error "Sequence contains no matching element"
nameof(Tag.Name), nameof(Tag.AuditingInfo)}};await dbContext.Database.CreateExecutionStrategy().ExecuteInTransactionAsync(()=> dbContext.BulkInsertOrUpdateAsync(tagsToSave, bulkConfig),()=> Task.FromResult(true));
System.InvalidOperationException
Sequence contains no matching element
at System.Linq.ThrowHelper.ThrowNoMatchException()
at System.Linq.Enumerable.First[TSource](IEnumerable1 source, Func2 predicate)
at EFCore.BulkExtensions.TableInfo.<>c__DisplayClass189_01.<LoadData>b__3(String b) at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](List1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer) at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector)
at EFCore.BulkExtensions.TableInfo.LoadData[T](DbContext context, Type type, IEnumerable1 entities, Boolean loadOnlyPKColumn) at EFCore.BulkExtensions.TableInfo.CreateInstance[T](DbContext context, Type type, IEnumerable1 entities, OperationType operationType, BulkConfig bulkConfig)
at EFCore.BulkExtensions.DbContextBulkTransaction.ExecuteAsync[T](DbContext context, Type type, IEnumerable1 entities, OperationType operationType, BulkConfig bulkConfig, Action1 progress, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.<>c__DisplayClass20_01.<<ExecuteInTransactionAsync>b__0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.<>c__DisplayClass24_02.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.<>c__DisplayClass24_02.<<ExecuteInTransactionAsync>b__0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
at SampleTest.Should() in ***\SampleTest.cs:line 57
Used version: 8.0.3
The text was updated successfully, but these errors were encountered:
Stack trace:
Used version: 8.0.3
The text was updated successfully, but these errors were encountered: