private void BulkUpdateCore(IEnumerable <T> items, Action <IDbConnection, IDbTransaction, string> tempTableAction) { if (_tableInfo.PrimaryKey.Count() != 1) { throw new InvalidOperationException( $"Table {_tableInfo.Name} has none, or composite primary key. Primary key must be one column only."); } if (items != null) { using (var bulkUpdate = _provider.CreateBulkUpdate()) { bulkUpdate.DestinationTableName = _tableInfo.Name; bulkUpdate.PrimaryKeyColumn = _tableInfo.PrimaryKey.FirstOrDefault().Name; bulkUpdate.TempTableAction = tempTableAction; using (var reader = new KormDataReader <T>(items, _commandGenerator)) { bulkUpdate.Update(reader); } } } }
/// <summary> /// Creates instance of <see cref="IBulkUpdate"/>. /// </summary> /// <returns>Instance of <see cref="IBulkUpdate"/>.</returns> public IBulkUpdate CreateBulkUpdate() => _queryProvider.CreateBulkUpdate();