private void UnregisterColumnName(SqlBulkCopyColumnOrderHint orderHint, string columnName) { if (Contains(orderHint)) { _columnNames.Remove(columnName); orderHint.NameChanging -= ColumnNameChanging; } }
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBulkCopyColumnOrderHintCollection.xml' path='docs/members[@name="SqlBulkCopyColumnOrderHintCollection"]/Remove/*'/> public void Remove(SqlBulkCopyColumnOrderHint columnOrderHint) { if (columnOrderHint == null) { throw new ArgumentNullException(nameof(columnOrderHint)); } // OnRemove only works with the List instance and not the InnerList instance List.Remove(columnOrderHint); }
private void RegisterColumnName(SqlBulkCopyColumnOrderHint orderHint, string columnName) { if (_columnNames.Contains(columnName)) { throw SQL.BulkLoadOrderHintDuplicateColumn(orderHint.Column); } _columnNames.Add(columnName); orderHint.NameChanging += ColumnNameChanging; }
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBulkCopyColumnOrderHintCollection.xml' path='docs/members[@name="SqlBulkCopyColumnOrderHintCollection"]/Insert/*'/> public void Insert(int index, SqlBulkCopyColumnOrderHint columnOrderHint) { // Try inserting into an invalid index to throw an exception if (index < 0 || index > InnerList.Count) { InnerList.Insert(index, columnOrderHint); } if (columnOrderHint == null) { throw new ArgumentNullException(nameof(columnOrderHint)); } RegisterColumnName(columnOrderHint, columnOrderHint.Column); InnerList.Insert(index, columnOrderHint); }
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBulkCopyColumnOrderHintCollection.xml' path='docs/members[@name="SqlBulkCopyColumnOrderHintCollection"]/Add[@name="columnOrderHintParameter"]/*'/> public SqlBulkCopyColumnOrderHint Add(SqlBulkCopyColumnOrderHint columnOrderHint) { if (columnOrderHint == null) { throw new ArgumentNullException(nameof(columnOrderHint)); } if (string.IsNullOrEmpty(columnOrderHint.Column) || columnOrderHint.SortOrder == SortOrder.Unspecified) { throw SQL.BulkLoadInvalidOrderHint(); } RegisterColumnName(columnOrderHint, columnOrderHint.Column); InnerList.Add(columnOrderHint); return(columnOrderHint); }
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBulkCopyColumnOrderHintCollection.xml' path='docs/members[@name="SqlBulkCopyColumnOrderHintCollection"]/IndexOf/*'/> public int IndexOf(SqlBulkCopyColumnOrderHint value) => InnerList.IndexOf(value);
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBulkCopyColumnOrderHintCollection.xml' path='docs/members[@name="SqlBulkCopyColumnOrderHintCollection"]/Contains/*'/> public bool Contains(SqlBulkCopyColumnOrderHint value) => InnerList.Contains(value);