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