Created
August 4, 2012 01:30
-
-
Save imphasing/3253362 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MahBalls | |
{ | |
using System; | |
using System.Data.Common; | |
using MySql.Data.MySqlClient; | |
using System.Collections.Generic; | |
public class DataManager : IDisposable | |
{ | |
private bool disposed = false; | |
private DbConnection connection; | |
private ILog logger; | |
public DataManager(string connectionString) | |
{ | |
connection = new MySqlConnection(connectionString); | |
connection.Open(); | |
} | |
public void Dispose() | |
{ | |
Dispose(true); | |
GC.SuppressFinalize(this); | |
} | |
private void Dispose(bool disposing) | |
{ | |
if (!disposed) | |
{ | |
if (disposing) | |
{ | |
connection.Close(); | |
connection.Dispose(); | |
} | |
connection = null; | |
disposed = true; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment