internal async Task LoadOutputDataAsync <T>(DbContext context, Type type, IList <T> entities, CancellationToken cancellationToken) where T : class { bool hasIdentity = OutputPropertyColumnNamesDict.Any(a => a.Value == IdentityColumnName); if (BulkConfig.SetOutputIdentity && hasIdentity) { string sqlQuery = SqlQueryBuilder.SelectFromOutputTable(this); //var entitiesWithOutputIdentity = await QueryOutputTableAsync<T>(context, sqlQuery).ToListAsync(cancellationToken).ConfigureAwait(false); // TempFIX var entitiesWithOutputIdentity = (typeof(T) == type) ? QueryOutputTable <T>(context, sqlQuery).ToList() : QueryOutputTable(context, type, sqlQuery).Cast <T>().ToList(); UpdateEntitiesIdentity(type, entities, entitiesWithOutputIdentity); } if (BulkConfig.CalculateStats) { int numberUpdated = await GetNumberUpdatedAsync(context, cancellationToken).ConfigureAwait(false); int numberDeleted = await GetNumberDeletedAsync(context, cancellationToken).ConfigureAwait(false); BulkConfig.StatsInfo = new StatsInfo { StatsNumberUpdated = numberUpdated, StatsNumberDeleted = numberDeleted, StatsNumberInserted = entities.Count - numberUpdated - numberDeleted }; } }
internal void LoadOutputData<T>(DbContext context, Type type, IList<T> entities) where T : class { bool hasIdentity = OutputPropertyColumnNamesDict.Any(a => a.Value == IdentityColumnName); if (BulkConfig.SetOutputIdentity && hasIdentity) { string sqlQuery = SqlQueryBuilder.SelectFromOutputTable(this); var entitiesWithOutputIdentity = (typeof(T) == type) ? QueryOutputTable<T>(context, sqlQuery).ToList() : QueryOutputTable(context, type, sqlQuery).Cast<T>().ToList(); UpdateEntitiesIdentity(type, entities, entitiesWithOutputIdentity); } if (BulkConfig.CalculateStats) { string sqlQueryCount = SqlQueryBuilder.SelectCountIsUpdateFromOutputTable(this); int numberUpdated = GetNumberUpdated(context); BulkConfig.StatsInfo = new StatsInfo { StatsNumberUpdated = numberUpdated, StatsNumberInserted = entities.Count - numberUpdated }; } }