2 // System.Data.Common.DbCommand
5 // Tim Coleman (tim@timcoleman.com)
7 // Copyright (C) Tim Coleman, 2003
12 using System.ComponentModel;
15 namespace System.Data.Common {
16 public abstract class DbCommand : Component, IDbCommand, IDisposable
18 protected DbCommand ()
24 public abstract string CommandText { get; set; }
25 public abstract int CommandTimeout { get; set; }
26 public abstract CommandType CommandType { get; set; }
28 public DbConnection Connection {
29 get { return DbConnection; }
30 set { DbConnection = value; }
33 protected abstract DbConnection DbConnection { get; set; }
34 protected abstract DbParameterCollection DbParameterCollection { get; set; }
35 protected abstract DbTransaction DbTransaction { get; set; }
36 public abstract bool DesignTimeVisible { get; set; }
38 IDbConnection IDbCommand.Connection {
39 get { return Connection; }
40 set { Connection = (DbConnection) value; }
43 IDataParameterCollection IDbCommand.Parameters {
44 get { return Parameters; }
47 IDbTransaction IDbCommand.Transaction {
48 get { return Transaction; }
49 set { Transaction = (DbTransaction) value; }
53 public virtual DbCommandOptionalFeatures OptionalFeatures {
54 get { throw new NotImplementedException (); }
57 public DbParameterCollection Parameters {
58 get { return DbParameterCollection; }
61 public DbTransaction Transaction {
62 get { return DbTransaction; }
63 set { DbTransaction = value; }
66 public abstract UpdateRowSource UpdatedRowSource { get; set; }
68 #endregion // Properties
72 public abstract void Cancel ();
73 protected abstract DbParameter CreateDbParameter ();
75 public DbParameter CreateParameter ()
77 return CreateDbParameter ();
80 protected abstract DbDataReader ExecuteDbDataReader (CommandBehavior behavior);
83 protected virtual DbDataReader ExecuteDbPageReader (CommandBehavior behavior, int startRecord, int maxRecords)
85 throw new NotImplementedException ();
88 public abstract int ExecuteNonQuery ();
89 public DbDataReader ExecutePageReader (CommandBehavior behavior, int startRecord, int maxRecords)
91 return ExecuteDbPageReader (behavior, startRecord, maxRecords);
95 public DbDataReader ExecuteReader ()
97 throw new NotImplementedException ();
101 public DbDataReader ExecuteReader (CommandBehavior behavior)
103 throw new NotImplementedException ();
106 public abstract object ExecuteScalar ();
108 IDbDataParameter IDbCommand.CreateParameter ()
110 return CreateParameter ();
113 IDataReader IDbCommand.ExecuteReader ()
115 return ExecuteReader ();
118 IDataReader IDbCommand.ExecuteReader (CommandBehavior behavior)
120 return ExecuteReader (behavior);
123 public abstract void Prepare ();
125 #endregion // Methods