private async Task CommitChangesAddedItemsAsync(HashSet <T> items, bool useAsync) { if (items?.Count > 0) { GenerateCustomPrimaryKeys(items); bool hasIdentity = CheckIfCanUseIdentityPrimaryKey(); using (DbCommand command = _commandGenerator.GetInsertCommand()) { PrepareCommand(command); foreach (T item in items) { _commandGenerator.FillCommand(command, item); if (hasIdentity) { var id = await ExecuteScalarAsync(command, useAsync); _tableInfo.IdentityPrimaryKey.SetValue(item, id); } else { await ExecuteNonQueryAsync(command, useAsync); } } } } }
private void CommitChangesAddedItems(HashSet <T> items) { GeneratePrimaryKeys(items); using (DbCommand command = _commandGenerator.GetInsertCommand()) { foreach (T item in items) { _commandGenerator.FillCommand(command, item); _provider.ExecuteNonQueryCommand(command); } } }
private async Task CommitChangesAddedItemsAsync(HashSet <T> items, bool useAsync) { if (items?.Count > 0) { GeneratePrimaryKeys(items); using (DbCommand command = _commandGenerator.GetInsertCommand()) { PrepareCommand(command); foreach (T item in items) { _commandGenerator.FillCommand(command, item); await ExecuteNonQueryAsync(command, useAsync); } } } }