Пример #1
0
    /// <summary>
    ///     Returns the underlying command as a typed command - this is used to unwrap the profiled mini profiler stuff
    /// </summary>
    /// <typeparam name="TCommand"></typeparam>
    /// <param name="command"></param>
    /// <returns></returns>
    public static TCommand GetTypedCommand <TCommand>(IDbCommand command)
        where TCommand : class, IDbCommand
    {
        IDbCommand?c = command;

        for (; ;)
        {
            switch (c)
            {
            case TCommand ofType:
                return(ofType);

            case FaultHandlingDbCommand faultHandling:
                c = faultHandling.Inner;
                break;

            case ProfiledDbCommand profiled:
                c = profiled.InternalCommand;
                break;

            default:
                throw new NotSupportedException(command.GetType().FullName);
            }
        }
    }
Пример #2
0
        public RowUpdatedEventArgs(DataRow dataRow, IDbCommand?command, StatementType statementType, DataTableMapping tableMapping)
        {
            switch (statementType)
            {
            case StatementType.Select:
            case StatementType.Insert:
            case StatementType.Update:
            case StatementType.Delete:
            case StatementType.Batch:
                break;

            default:
                throw ADP.InvalidStatementType(statementType);
            }
            _dataRow       = dataRow;
            _command       = command;
            _statementType = statementType;
            _tableMapping  = tableMapping;
        }
Пример #3
0
        public RowUpdatingEventArgs(DataRow dataRow, IDbCommand?command, StatementType statementType, DataTableMapping tableMapping)
        {
            ADP.CheckArgumentNull(dataRow, nameof(dataRow));
            ADP.CheckArgumentNull(tableMapping, nameof(tableMapping));
            switch (statementType)
            {
            case StatementType.Select:
            case StatementType.Insert:
            case StatementType.Update:
            case StatementType.Delete:
                break;

            case StatementType.Batch:
                throw ADP.NotSupportedStatementType(statementType, nameof(RowUpdatingEventArgs));

            default:
                throw ADP.InvalidStatementType(statementType);
            }
            _dataRow       = dataRow;
            _command       = command; // maybe null
            _statementType = statementType;
            _tableMapping  = tableMapping;
        }
Пример #4
0
 protected override RowUpdatingEventArgs CreateRowUpdatingEvent(DataRow dataRow, IDbCommand?command, StatementType statementType, DataTableMapping tableMapping)
 {
     return(new OleDbRowUpdatingEventArgs(dataRow, command, statementType, tableMapping));
 }
Пример #5
0
 public NpgsqlRowUpdatedEventArgs(DataRow dataRow, IDbCommand?command, System.Data.StatementType statementType,
                                  DataTableMapping tableMapping)
     : base(dataRow, command, statementType, tableMapping)
 {
 }
 public OleDbRowUpdatingEventArgs(DataRow dataRow, IDbCommand?command, StatementType statementType, DataTableMapping tableMapping)
     : base(dataRow, command, statementType, tableMapping)
 {
 }
Пример #7
0
 public OdbcRowUpdatedEventArgs(DataRow row, IDbCommand?command, StatementType statementType, DataTableMapping tableMapping)
     : base(row, command, statementType, tableMapping)
 {
 }