/// <summary> /// Sets the identity column for the table. /// </summary> /// <param name="columnName"></param> /// <param name="direction"></param> /// <returns></returns> public QueryInsertReady <T> SetIdentityColumn(Expression <Func <T, object> > columnName, ColumnDirectionType direction) { var propertyName = BulkOperationsHelper.GetPropertyName(columnName); _outputIdentity = direction; if (propertyName == null) { throw new SqlBulkToolsException("SetIdentityColumn column name can't be null"); } if (_identityColumn == null) { string actualPropertyName; if (_customColumnMappings.TryGetValue(propertyName, out actualPropertyName)) { _identityColumn = actualPropertyName; } else { _identityColumn = propertyName; } } else { throw new SqlBulkToolsException("Can't have more than one identity column"); } _columns.Add(propertyName); return(this); }
/// <summary> /// Sets the identity column for the table. /// </summary> /// <param name="columnName"></param> /// <param name="direction"></param> /// <returns></returns> public SimpleInsertQueryReady <T> SetIdentityColumn(Expression <Func <T, object> > columnName, ColumnDirectionType direction) { var propertyName = BulkOperationsHelper.GetPropertyName(columnName); _outputIdentity = direction; if (propertyName == null) { throw new SqlBulkToolsException("SetIdentityColumn column name can't be null"); } if (_identityColumn == null) { _identityColumn = propertyName; } else { throw new SqlBulkToolsException("Can't have more than one identity column"); } _columns.Add(propertyName); return(this); }
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member /// <summary> /// /// </summary> /// <param name="list"></param> /// <param name="tableName"></param> /// <param name="schema"></param> /// <param name="columns"></param> /// <param name="disableIndexList"></param> /// <param name="disableAllIndexes"></param> /// <param name="customColumnMappings"></param> /// <param name="sqlTimeout"></param> /// <param name="bulkCopyTimeout"></param> /// <param name="bulkCopyEnableStreaming"></param> /// <param name="bulkCopyNotifyAfter"></param> /// <param name="bulkCopyBatchSize"></param> /// <param name="sqlBulkCopyOptions"></param> /// <param name="bulkCopyDelegates"></param> protected AbstractOperation(IEnumerable <T> list, string tableName, string schema, HashSet <string> columns, HashSet <string> disableIndexList, bool disableAllIndexes, Dictionary <string, string> customColumnMappings, int sqlTimeout, int bulkCopyTimeout, bool bulkCopyEnableStreaming, int?bulkCopyNotifyAfter, int?bulkCopyBatchSize, SqlBulkCopyOptions sqlBulkCopyOptions, IEnumerable <SqlRowsCopiedEventHandler> bulkCopyDelegates) { _list = list; _tableName = tableName; _schema = schema; _columns = columns; _disableIndexList = disableIndexList; _disableAllIndexes = disableAllIndexes; _customColumnMappings = customColumnMappings; _sqlTimeout = sqlTimeout; _bulkCopyTimeout = bulkCopyTimeout; _bulkCopyEnableStreaming = bulkCopyEnableStreaming; _bulkCopyNotifyAfter = bulkCopyNotifyAfter; _bulkCopyBatchSize = bulkCopyBatchSize; _sqlBulkCopyOptions = sqlBulkCopyOptions; _identityColumn = null; _collationColumnDic = new Dictionary <string, string>(); _outputIdentityDic = new Dictionary <int, T>(); _outputIdentity = ColumnDirectionType.Input; _matchTargetOn = new List <string>(); _bulkCopyDelegates = bulkCopyDelegates; }
/// <summary> /// /// </summary> /// <param name="singleEntity"></param> /// <param name="tableName"></param> /// <param name="schema"></param> /// <param name="columns"></param> /// <param name="customColumnMappings"></param> /// <param name="sqlParams"></param> public QueryInsertReady(T singleEntity, string tableName, string schema, HashSet <string> columns, Dictionary <string, string> customColumnMappings, List <SqlParameter> sqlParams) { _singleEntity = singleEntity; _tableName = tableName; _schema = schema; _columns = columns; _customColumnMappings = customColumnMappings; _sqlParams = sqlParams; _outputIdentity = ColumnDirectionType.Input; }
/// <summary> /// /// </summary> /// <param name="singleEntity"></param> /// <param name="tableName"></param> /// <param name="schema"></param> /// <param name="columns"></param> /// <param name="customColumnMappings"></param> /// <param name="sqlParams"></param> public QueryUpsertReady(T singleEntity, string tableName, string schema, HashSet <string> columns, Dictionary <string, string> customColumnMappings, List <SqlParameter> sqlParams) { _singleEntity = singleEntity; _tableName = tableName; _schema = schema; _columns = columns; _customColumnMappings = customColumnMappings; _sqlParams = sqlParams; _matchTargetOnSet = new HashSet <string>(); _outputIdentity = ColumnDirectionType.Input; _excludeFromUpdate = new HashSet <string>(); _collationColumnDic = new Dictionary <string, string>(); }
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member /// <summary> /// /// </summary> /// <param name="list"></param> /// <param name="tableName"></param> /// <param name="schema"></param> /// <param name="columns"></param> /// <param name="customColumnMappings"></param> /// <param name="bulkCopySettings"></param> protected AbstractOperation(IEnumerable <T> list, string tableName, string schema, HashSet <string> columns, Dictionary <string, string> customColumnMappings, BulkCopySettings bulkCopySettings) { _list = list; _tableName = tableName; _schema = schema; _columns = columns; _disableAllIndexes = false; _customColumnMappings = customColumnMappings; _identityColumn = null; _collationColumnDic = new Dictionary <string, string>(); _outputIdentityDic = new Dictionary <int, T>(); _outputIdentity = ColumnDirectionType.Input; _matchTargetOn = new List <string>(); _bulkCopySettings = bulkCopySettings; _tableHint = "HOLDLOCK"; }
/// <summary> /// Sets the identity column for the table. /// </summary> /// <param name="columnName"></param> /// <param name="outputIdentity"></param> /// <returns></returns> public QueryUpsertReady <T> SetIdentityColumn(Expression <Func <T, object> > columnName, ColumnDirectionType outputIdentity) { var propertyName = BulkOperationsHelper.GetPropertyName(columnName); _outputIdentity = outputIdentity; if (propertyName == null) { throw new SqlBulkToolsException("SetIdentityColumn column name can't be null"); } if (_identityColumn == null) { _identityColumn = BulkOperationsHelper.GetActualColumn(_customColumnMappings, propertyName); } else { throw new SqlBulkToolsException("Can't have more than one identity column"); } return(this); }
/// <summary> /// Sets the identity column for the table. Required if an Identity column exists in table and one of the two /// following conditions is met: (1) MatchTargetOn list contains an identity column (2) AddAllColumns is used in setup. /// </summary> /// <param name="columnName"></param> /// <param name="outputIdentity"></param> /// <returns></returns> public BulkInsertOrUpdate <T> SetIdentityColumn(Expression <Func <T, object> > columnName, ColumnDirectionType outputIdentity) { base.SetIdentity(columnName, outputIdentity); return(this); }
/// <summary> /// Sets the identity column for the table. Required if an Identity column exists in table and one of the two /// following conditions is met: (1) MatchTargetOn list contains an identity column (2) AddAllColumns is used in setup. /// </summary> /// <param name="columnName"></param> /// <param name="outputIdentity"></param> /// <returns></returns> public BulkUpdate <T> SetIdentityColumn(string columnName, ColumnDirectionType outputIdentity) { base.SetIdentity(columnName, outputIdentity); return(this); }
/// <summary> /// /// </summary> /// <param name="columnName"></param> /// <param name="outputIdentity"></param> protected void SetIdentity(Expression <Func <T, object> > columnName, ColumnDirectionType outputIdentity) { _outputIdentity = outputIdentity; SetIdentity(columnName); }
/// <summary> /// /// </summary> /// <param name="columnName"></param> /// <param name="outputIdentity"></param> protected void SetIdentity(string columnName, ColumnDirectionType outputIdentity) { _outputIdentity = outputIdentity; SetIdentity(columnName); }
/// <summary> /// Sets the identity column for the table. Required if an Identity column exists in table and one of the two /// following conditions is met: (1) MatchTargetOn list contains an identity column (2) AddAllColumns is used in setup. /// </summary> /// <param name="columnName"></param> /// <param name="outputIdentity"></param> /// <returns></returns> public BulkDelete <T> SetIdentityColumn(Expression <Func <T, object> > columnName, ColumnDirectionType outputIdentity) { SetIdentity(columnName, outputIdentity); return(this); }