[Mono-devel-list] Patch for SqlConnection

Sureshkumar T tsureshkumar at novell.com
Fri Mar 11 02:26:05 EST 2005


> From: Gonzalo Paniagua Javier <gonzalo at ximian.com>
> To: Mono Development <mono-devel-list at lists.ximian.com>
> Subject: [Mono-devel-list] Patch for SqlConnection
> Date: Fri, 11 Mar 2005 00:50:59 -0500
> 
> Hi.
> 
> Attached there's a small patch that adds a finalizer to SqlConnection
> and moves the 'disposed = true' into the finally in Dispose(bool).

SqlConnection does not have any unmanaged resources. Hence, IMHO, it is
not necessary to have finalizer method. We can avoid an overhead to GC.

I donot see the reason to mark disposed to true in case any exception
occurs while closing the connection.

-suresh.

> 
> Any objections?
> 
> -Gonzalo
> 
> 
> --=-yYoFVNPF2KxporljqjIH
> Content-Disposition: attachment; filename=patchety.patch
> Content-Type: text/x-patch; name=patchety.patch; charset=UTF-8
> Content-Transfer-Encoding: 7bit
> 
> Index: SqlConnection.cs
> ===================================================================
> --- SqlConnection.cs	(revision 41656)
> +++ SqlConnection.cs	(working copy)
> @@ -411,11 +411,10 @@
>                                                  dataSource = ""; // default dataSource
>                                                  ConnectionString = null;
>                                          }
> +                                } finally {
>                                          disposed = true;
> -                                } finally {
>                                          base.Dispose (disposing);
>                                  }
> -                                
>  			}
>  		}
>  
> @@ -455,6 +454,11 @@
>  			GC.SuppressFinalize (this);
>  		}
>  
> +		~SqlConnection ()
> +		{
> +			Dispose (false);
> +		}
> +
>  		public 
>  #if NET_2_0
>  		override
> 
> --=-yYoFVNPF2KxporljqjIH--
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list




More information about the Mono-devel-list mailing list