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.Transactions;
  33. using System.Data.Common;
  34. using System.EnterpriseServices;
  35. namespace System.Data.ProviderBase {
  36. public abstract class DbConnectionBase : DbConnection
  37. {
  38. #region Fields
  39. DbConnectionFactory connectionFactory;
  40. DbConnectionString connectionOptions;
  41. string connectionString;
  42. bool disposed = false;
  43. #endregion // Fields
  44. #region Constructors
  45. protected DbConnectionBase (DbConnectionBase connection)
  46. : this (connection.ConnectionFactory)
  47. {
  48. }
  49. protected DbConnectionBase (DbConnectionFactory connectionFactory)
  50. {
  51. this.connectionFactory = connectionFactory;
  52. }
  53. protected DbConnectionBase ()
  54. {
  55. }
  56. #endregion // Constructors
  57. #region Properties
  58. [MonoTODO]
  59. protected int CloseCount {
  60. get { throw new NotImplementedException (); }
  61. }
  62. protected internal DbConnectionFactory ConnectionFactory {
  63. get { return connectionFactory; }
  64. }
  65. protected internal DbConnectionString ConnectionOptions {
  66. get { return connectionOptions; }
  67. }
  68. public override string ConnectionString {
  69. get { return connectionString; }
  70. set {
  71. //connectionOptions = ConnectionFactory.CreateConnectionOptionsInternal (value);
  72. connectionString = value;
  73. }
  74. }
  75. [MonoTODO]
  76. public override int ConnectionTimeout {
  77. get { throw new NotImplementedException (); }
  78. }
  79. [MonoTODO]
  80. protected virtual int ConnectionTimeoutInternal {
  81. get { throw new NotImplementedException (); }
  82. }
  83. [MonoTODO]
  84. public override string Database {
  85. get { throw new NotImplementedException (); }
  86. }
  87. [MonoTODO]
  88. public override string DataSource {
  89. get { throw new NotImplementedException (); }
  90. }
  91. [MonoTODO]
  92. protected internal DbConnectionInternal InnerConnection {
  93. get { throw new NotImplementedException (); }
  94. }
  95. [MonoTODO]
  96. public override string ServerVersion {
  97. get { throw new NotImplementedException (); }
  98. }
  99. [MonoTODO]
  100. public override ConnectionState State {
  101. get { throw new NotImplementedException (); }
  102. }
  103. #endregion // Properties
  104. #region Events
  105. public event StateChangeEventHandler StateChange;
  106. #endregion // Events
  107. #region Methods
  108. [MonoTODO]
  109. protected override DbTransaction BeginDbTransaction (IsolationLevel isolationLevel)
  110. {
  111. throw new NotImplementedException ();
  112. }
  113. [MonoTODO]
  114. public override void ChangeDatabase (string value)
  115. {
  116. throw new NotImplementedException ();
  117. }
  118. [MonoTODO]
  119. public override void Close ()
  120. {
  121. throw new NotImplementedException ();
  122. }
  123. protected override DbCommand CreateDbCommand ()
  124. {
  125. DbCommand cmd = (DbCommand) ConnectionFactory.ProviderFactory.CreateCommand ();
  126. cmd.Connection = this;
  127. return cmd;
  128. }
  129. protected override void Dispose (bool disposing)
  130. {
  131. if (!disposed) {
  132. try {
  133. if (disposing) {
  134. // do necessary clean up
  135. }
  136. disposed = true;
  137. } finally {
  138. base.Dispose (disposing);
  139. }
  140. }
  141. }
  142. [MonoTODO]
  143. public void EnlistDistributedTransaction (EnterpriseServices.ITransaction transaction)
  144. {
  145. throw new NotImplementedException ();
  146. }
  147. [MonoTODO]
  148. public void EnlistTransaction (Transaction transaction)
  149. {
  150. throw new NotImplementedException ();
  151. }
  152. [MonoTODO]
  153. protected virtual DbMetaDataFactory GetMetaDataFactory (DbConnectionInternal internalConnection)
  154. {
  155. throw new NotImplementedException ();
  156. }
  157. protected void OnStateChange (ConnectionState originalState, ConnectionState currentState)
  158. {
  159. if (StateChange != null)
  160. StateChange (this, new StateChangeEventArgs (originalState, currentState));
  161. }
  162. [MonoTODO]
  163. public override void Open ()
  164. {
  165. throw new NotImplementedException ();
  166. }
  167. [MonoTODO]
  168. public override DataTable GetSchema ()
  169. {
  170. throw new NotImplementedException ();
  171. }
  172. [MonoTODO]
  173. public override DataTable GetSchema (string collectionName)
  174. {
  175. throw new NotImplementedException ();
  176. }
  177. [MonoTODO]
  178. public override DataTable GetSchema (string collectionName, string [] restrictionValues)
  179. {
  180. throw new NotImplementedException ();
  181. }
  182. #endregion // Methods
  183. }
  184. }
  185. #endif