Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémie Laval <jeremie.laval@gmail.com>2011-01-21 18:13:59 +0300
committerJérémie Laval <jeremie.laval@gmail.com>2011-01-22 04:21:15 +0300
commitbf0339ea2bda1bc16245908c81fdd70d0e6f862b (patch)
treeb76176b7f94301f529f7602488dfdcc89513affe /mcs/class/WebMatrix.Data
parentaa0a9518f1863119b5d6b91abf4c775a5aa3594c (diff)
Add Dispose calls to Database
Diffstat (limited to 'mcs/class/WebMatrix.Data')
-rw-r--r--mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs9
1 files changed, 9 insertions, 0 deletions
diff --git a/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs b/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
index 9b5da04b974..6c9287ce302 100644
--- a/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
@@ -70,7 +70,13 @@ namespace WebMatrix.Data
public void Dispose ()
{
+ Dispose (true);
+ }
+ protected virtual void Dispose (bool disposing)
+ {
+ if (disposing)
+ connection.Dispose ();
}
public int Execute (string commandText, params object[] args)
@@ -81,6 +87,7 @@ namespace WebMatrix.Data
connection.Open ();
var result = command.ExecuteNonQuery ();
connection.Close ();
+ command.Dispose ();
return result;
}
@@ -127,6 +134,7 @@ namespace WebMatrix.Data
}
connection.Close ();
+ command.Dispose ();
return result;
}
@@ -139,6 +147,7 @@ namespace WebMatrix.Data
connection.Open ();
var result = command.ExecuteScalar ();
connection.Close ();
+ command.Dispose ();
return result;
}