diff options
author | Sureshkumar T <suresh@mono-cvs.ximian.com> | 2005-02-02 13:36:06 +0300 |
---|---|---|
committer | Sureshkumar T <suresh@mono-cvs.ximian.com> | 2005-02-02 13:36:06 +0300 |
commit | 7ad878f3ee28a60851f4a1ea6227cfa74cc8b321 (patch) | |
tree | f356cd3e2d86a19cd5d0f6f627085dcf6d0266de /mcs | |
parent | f40c3259295bc21fe3ba6455893724938edb9848 (diff) |
In System.Data.ProviderBase:
2005-02-02 Sureshkumar T <tsureshkumar@novell.com>
* DbConnectionBase.cs: Implement Dispose Pattern
In System.Data.Common:
2005-02-02 Sureshkumar T <tsureshkumar@novell.com>
* DbConnection.cs: Implement Dispose pattern.
svn path=/trunk/mcs/; revision=39973
Diffstat (limited to 'mcs')
4 files changed, 41 insertions, 2 deletions
diff --git a/mcs/class/System.Data/System.Data.Common/ChangeLog b/mcs/class/System.Data/System.Data.Common/ChangeLog index 73bdc3d0e31..4c8cd4f57e1 100755 --- a/mcs/class/System.Data/System.Data.Common/ChangeLog +++ b/mcs/class/System.Data/System.Data.Common/ChangeLog @@ -1,3 +1,7 @@ +2005-02-02 Sureshkumar T <tsureshkumar@novell.com> + + * DbConnection.cs: Implement Dispose pattern. + 2005-01-25 Atsushi Enomoto <atsushi@ximian.com> * DbDataPermission.cs : Empty.Union(Empty) is Empty. diff --git a/mcs/class/System.Data/System.Data.Common/DbConnection.cs b/mcs/class/System.Data/System.Data.Common/DbConnection.cs index e53955ad2f7..3142583ebb3 100644 --- a/mcs/class/System.Data/System.Data.Common/DbConnection.cs +++ b/mcs/class/System.Data/System.Data.Common/DbConnection.cs @@ -39,6 +39,11 @@ using System.EnterpriseServices; namespace System.Data.Common { public abstract class DbConnection : Component, IDbConnection, IDisposable { + + #region Fields + bool disposed = false; + #endregion //Fields + #region Constructors protected DbConnection () @@ -82,6 +87,23 @@ namespace System.Data.Common { return CreateDbCommand (); } + protected override void Dispose (bool disposing) + { + if (!disposed) { + try { + if (disposing) { + // unmanaged cleanup + } + + disposed = true; + } finally { + base.Dispose (disposing); + } + + } + } + + protected abstract DbCommand CreateDbCommand (); [MonoTODO] diff --git a/mcs/class/System.Data/System.Data.ProviderBase/ChangeLog b/mcs/class/System.Data/System.Data.ProviderBase/ChangeLog index a4926fb7407..88301fc8e76 100755 --- a/mcs/class/System.Data/System.Data.ProviderBase/ChangeLog +++ b/mcs/class/System.Data/System.Data.ProviderBase/ChangeLog @@ -1,3 +1,7 @@ +2005-02-02 Sureshkumar T <tsureshkumar@novell.com> + + * DbConnectionBase.cs: Implement Dispose Pattern + 2004-11-24 Sureshkumar T <tsureshkumar@novell.com> * DbParameterCollectionBase.cs: Class name changed according to diff --git a/mcs/class/System.Data/System.Data.ProviderBase/DbConnectionBase.cs b/mcs/class/System.Data/System.Data.ProviderBase/DbConnectionBase.cs index 62b413bd99b..377432bb4e5 100644 --- a/mcs/class/System.Data/System.Data.ProviderBase/DbConnectionBase.cs +++ b/mcs/class/System.Data/System.Data.ProviderBase/DbConnectionBase.cs @@ -43,6 +43,7 @@ namespace System.Data.ProviderBase { DbConnectionFactory connectionFactory; DbConnectionString connectionOptions; string connectionString; + bool disposed = false; #endregion // Fields @@ -157,10 +158,18 @@ namespace System.Data.ProviderBase { return (DbCommand) ConnectionFactory.ProviderFactory.CreateCommand (); } - [MonoTODO] protected override void Dispose (bool disposing) { - throw new NotImplementedException (); + if (!disposed) { + try { + if (disposing) { + // do necessary clean up + } + disposed = true; + } finally { + base.Dispose (disposing); + } + } } [MonoTODO] |