private void OnRowUpdating(Object sender, NpgsqlRowUpdatingEventArgs value)
        {
            switch (value.StatementType)
            {
            case StatementType.Insert:
                value.Command = GetInsertCommand(value.Row, false);
                break;

            case StatementType.Update:
                value.Command = GetUpdateCommand(value.Row, false);
                break;

            case StatementType.Delete:
                value.Command = GetDeleteCommand(value.Row, false);
                break;
            }

            DataColumnMappingCollection columnMappings = value.TableMapping.ColumnMappings;

            foreach (IDataParameter parameter in value.Command.Parameters)
            {
                string dsColumnName = parameter.SourceColumn;
                if (columnMappings.Contains(parameter.SourceColumn))
                {
                    DataColumnMapping mapping = columnMappings[parameter.SourceColumn];
                    if (mapping != null)
                    {
                        dsColumnName = mapping.DataSetColumn;
                    }
                }

                DataRowVersion rowVersion = DataRowVersion.Default;
                if (value.StatementType == StatementType.Update)
                {
                    rowVersion = parameter.SourceVersion;
                }
                if (value.StatementType == StatementType.Delete)
                {
                    rowVersion = DataRowVersion.Original;
                }
                parameter.Value = value.Row [dsColumnName, rowVersion];
            }
        }
Пример #2
0
        private void OnRowUpdating(Object sender, NpgsqlRowUpdatingEventArgs value) {
            switch (value.StatementType)
            {
                case StatementType.Insert:
                    value.Command = GetInsertCommand(value.Row, false);
                    break;
                case StatementType.Update:
                    value.Command = GetUpdateCommand(value.Row, false);
                    break;
                case StatementType.Delete:
                    value.Command = GetDeleteCommand(value.Row, false);
                    break;
            }

            DataColumnMappingCollection columnMappings = value.TableMapping.ColumnMappings;
            foreach (IDataParameter parameter in value.Command.Parameters)
            {

                string dsColumnName = parameter.SourceColumn;
                if (columnMappings.Contains(parameter.SourceColumn))
                {
                    DataColumnMapping mapping = columnMappings[parameter.SourceColumn];
                    if (mapping != null)
                    {
                        dsColumnName = mapping.DataSetColumn;
                    }
                }

                DataRowVersion rowVersion = DataRowVersion.Default;
                if (value.StatementType == StatementType.Update)
                    rowVersion = parameter.SourceVersion;
                if (value.StatementType == StatementType.Delete)
                    rowVersion = DataRowVersion.Original;
                parameter.Value = value.Row [dsColumnName, rowVersion];
            }
        }
Пример #3
0
 private void RowUpdatingHandler(object sender, NpgsqlRowUpdatingEventArgs e)
 {
     base.RowUpdatingHandler(e);
 }
Пример #4
0
 /// <summary>
 /// Adds an event handler for the <see cref="NpgsqlDataAdapter.RowUpdating"/> event.
 /// </summary>
 /// <param name="sender">The sender</param>
 /// <param name="e">A <see cref="NpgsqlRowUpdatingEventArgs"/> instance containing information about the event.</param>
 private void RowUpdatingHandler(object sender, NpgsqlRowUpdatingEventArgs e)
 {
     base.RowUpdatingHandler(e);
 }
Пример #5
0
 /// <summary>
 /// Handles the RowUpdating event
 /// </summary>
 /// <param name="obj">The object that published the event</param>
 /// <param name="e">The NpgsqlRowUpdatingEventArgs</param>
 protected void RowUpdating(object obj, NpgsqlRowUpdatingEventArgs e)
 {
     base.RowUpdating(obj, e);
 }