DbCommand.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. //
  2. // System.Data.Common.DbCommand
  3. //
  4. // Author:
  5. // Tim Coleman ([email protected])
  6. //
  7. // Copyright (C) Tim Coleman, 2003
  8. //
  9. #if NET_1_2
  10. using System.ComponentModel;
  11. using System.Data;
  12. namespace System.Data.Common {
  13. public abstract class DbCommand : Component, IDbCommand, IDisposable
  14. {
  15. protected DbCommand ()
  16. {
  17. }
  18. #region Properties
  19. public abstract string CommandText { get; set; }
  20. public abstract int CommandTimeout { get; set; }
  21. public abstract CommandType CommandType { get; set; }
  22. public DbConnection Connection {
  23. get { return DbConnection; }
  24. set { DbConnection = value; }
  25. }
  26. protected abstract DbConnection DbConnection { get; set; }
  27. protected abstract DbParameterCollection DbParameterCollection { get; set; }
  28. protected abstract DbTransaction DbTransaction { get; set; }
  29. public abstract bool DesignTimeVisible { get; set; }
  30. IDbConnection IDbCommand.Connection {
  31. get { return Connection; }
  32. set { Connection = (DbConnection) value; }
  33. }
  34. IDataParameterCollection IDbCommand.Parameters {
  35. get { return Parameters; }
  36. }
  37. IDbTransaction IDbCommand.Transaction {
  38. get { return Transaction; }
  39. set { Transaction = (DbTransaction) value; }
  40. }
  41. [MonoTODO]
  42. public virtual DbCommandOptionalFeatures OptionalFeatures {
  43. get { throw new NotImplementedException (); }
  44. }
  45. public DbParameterCollection Parameters {
  46. get { return DbParameterCollection; }
  47. }
  48. public DbTransaction Transaction {
  49. get { return DbTransaction; }
  50. set { DbTransaction = value; }
  51. }
  52. public abstract UpdateRowSource UpdatedRowSource { get; set; }
  53. #endregion // Properties
  54. #region Methods
  55. public abstract void Cancel ();
  56. protected abstract DbParameter CreateDbParameter ();
  57. public DbParameter CreateParameter ()
  58. {
  59. return CreateDbParameter ();
  60. }
  61. protected abstract DbDataReader ExecuteDbDataReader (CommandBehavior behavior);
  62. [MonoTODO]
  63. protected virtual DbDataReader ExecuteDbPageReader (CommandBehavior behavior, int startRecord, int maxRecords)
  64. {
  65. throw new NotImplementedException ();
  66. }
  67. public abstract int ExecuteNonQuery ();
  68. public DbDataReader ExecutePageReader (CommandBehavior behavior, int startRecord, int maxRecords)
  69. {
  70. return ExecuteDbPageReader (behavior, startRecord, maxRecords);
  71. }
  72. [MonoTODO]
  73. public DbDataReader ExecuteReader ()
  74. {
  75. throw new NotImplementedException ();
  76. }
  77. [MonoTODO]
  78. public DbDataReader ExecuteReader (CommandBehavior behavior)
  79. {
  80. throw new NotImplementedException ();
  81. }
  82. public abstract object ExecuteScalar ();
  83. IDbDataParameter IDbCommand.CreateParameter ()
  84. {
  85. return CreateParameter ();
  86. }
  87. IDataReader IDbCommand.ExecuteReader ()
  88. {
  89. return ExecuteReader ();
  90. }
  91. IDataReader IDbCommand.ExecuteReader (CommandBehavior behavior)
  92. {
  93. return ExecuteReader (behavior);
  94. }
  95. public abstract void Prepare ();
  96. #endregion // Methods
  97. }
  98. }
  99. #endif