DbConnectionBase.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. //
  2. // System.Data.ProviderBase.DbConnectionBase
  3. //
  4. // Author:
  5. // Tim Coleman ([email protected])
  6. //
  7. // Copyright (C) Tim Coleman, 2003
  8. //
  9. //
  10. // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
  11. //
  12. // Permission is hereby granted, free of charge, to any person obtaining
  13. // a copy of this software and associated documentation files (the
  14. // "Software"), to deal in the Software without restriction, including
  15. // without limitation the rights to use, copy, modify, merge, publish,
  16. // distribute, sublicense, and/or sell copies of the Software, and to
  17. // permit persons to whom the Software is furnished to do so, subject to
  18. // the following conditions:
  19. //
  20. // The above copyright notice and this permission notice shall be
  21. // included in all copies or substantial portions of the Software.
  22. //
  23. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  27. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  28. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  29. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  30. //
  31. #if NET_2_0
  32. using System.Data.Common;
  33. using System.EnterpriseServices;
  34. namespace System.Data.ProviderBase {
  35. public abstract class DbConnectionBase : DbConnection
  36. {
  37. #region Fields
  38. DbConnectionFactory connectionFactory;
  39. DbConnectionString connectionOptions;
  40. string connectionString;
  41. bool disposed = false;
  42. #endregion // Fields
  43. #region Constructors
  44. protected DbConnectionBase (DbConnectionBase connection)
  45. : this (connection.ConnectionFactory)
  46. {
  47. }
  48. protected DbConnectionBase (DbConnectionFactory connectionFactory)
  49. {
  50. this.connectionFactory = connectionFactory;
  51. }
  52. protected DbConnectionBase ()
  53. {
  54. }
  55. #endregion // Constructors
  56. #region Properties
  57. [MonoTODO]
  58. protected int CloseCount {
  59. get { throw new NotImplementedException (); }
  60. }
  61. protected internal DbConnectionFactory ConnectionFactory {
  62. get { return connectionFactory; }
  63. }
  64. protected internal DbConnectionString ConnectionOptions {
  65. get { return connectionOptions; }
  66. }
  67. public override string ConnectionString {
  68. get { return connectionString; }
  69. set {
  70. //connectionOptions = ConnectionFactory.CreateConnectionOptionsInternal (value);
  71. connectionString = value;
  72. }
  73. }
  74. [MonoTODO]
  75. public override int ConnectionTimeout {
  76. get { throw new NotImplementedException (); }
  77. }
  78. [MonoTODO]
  79. protected virtual int ConnectionTimeoutInternal {
  80. get { throw new NotImplementedException (); }
  81. }
  82. [MonoTODO]
  83. public override string Database {
  84. get { throw new NotImplementedException (); }
  85. }
  86. [MonoTODO]
  87. public override string DataSource {
  88. get { throw new NotImplementedException (); }
  89. }
  90. [MonoTODO]
  91. protected internal DbConnectionInternal InnerConnection {
  92. get { throw new NotImplementedException (); }
  93. }
  94. [MonoTODO]
  95. public override string ServerVersion {
  96. get { throw new NotImplementedException (); }
  97. }
  98. [MonoTODO]
  99. public override ConnectionState State {
  100. get { throw new NotImplementedException (); }
  101. }
  102. #endregion // Properties
  103. #region Events
  104. public event StateChangeEventHandler StateChange;
  105. #endregion // Events
  106. #region Methods
  107. [MonoTODO]
  108. protected override DbTransaction BeginDbTransaction (IsolationLevel isolationLevel)
  109. {
  110. throw new NotImplementedException ();
  111. }
  112. [MonoTODO]
  113. public override void ChangeDatabase (string value)
  114. {
  115. throw new NotImplementedException ();
  116. }
  117. [MonoTODO]
  118. public override void Close ()
  119. {
  120. throw new NotImplementedException ();
  121. }
  122. protected override DbCommand CreateDbCommand ()
  123. {
  124. DbCommand cmd = (DbCommand) ConnectionFactory.ProviderFactory.CreateCommand ();
  125. cmd.Connection = this;
  126. return cmd;
  127. }
  128. protected override void Dispose (bool disposing)
  129. {
  130. if (!disposed) {
  131. try {
  132. if (disposing) {
  133. // do necessary clean up
  134. }
  135. disposed = true;
  136. } finally {
  137. base.Dispose (disposing);
  138. }
  139. }
  140. }
  141. [MonoTODO]
  142. public override void EnlistDistributedTransaction (ITransaction transaction)
  143. {
  144. throw new NotImplementedException ();
  145. }
  146. [MonoTODO]
  147. public override void EnlistTransaction (ITransaction transaction)
  148. {
  149. throw new NotImplementedException ();
  150. }
  151. [MonoTODO]
  152. protected virtual DbMetaDataFactory GetMetaDataFactory (DbConnectionInternal internalConnection)
  153. {
  154. throw new NotImplementedException ();
  155. }
  156. protected void OnStateChange (ConnectionState originalState, ConnectionState currentState)
  157. {
  158. if (StateChange != null)
  159. StateChange (this, new StateChangeEventArgs (originalState, currentState));
  160. }
  161. [MonoTODO]
  162. public override void Open ()
  163. {
  164. throw new NotImplementedException ();
  165. }
  166. [MonoTODO]
  167. public override DataTable GetSchema ()
  168. {
  169. throw new NotImplementedException ();
  170. }
  171. [MonoTODO]
  172. public override DataTable GetSchema (string collectionName)
  173. {
  174. throw new NotImplementedException ();
  175. }
  176. [MonoTODO]
  177. public override DataTable GetSchema (string collectionName, string [] restrictionValues)
  178. {
  179. throw new NotImplementedException ();
  180. }
  181. #endregion // Methods
  182. }
  183. }
  184. #endif