88using System . Threading ;
99
1010
11- namespace GenericSQLEntityHandler
11+ namespace EntityHandler
1212{
1313 public class GenericSQLEntityHandler
1414 {
@@ -21,7 +21,7 @@ public class GenericSQLEntityHandler
2121 private string reconnectSqlConnectionString = "" ;
2222
2323 private SqlTransaction sqlTransaction = null ;
24- private SqlConnection sqlConnection = null ;
24+
2525
2626 private Dictionary < Type , Dictionary < string , string > > columnInformationList = new Dictionary < Type , Dictionary < string , string > > ( ) ;
2727
@@ -103,7 +103,7 @@ public bool BulkSave<T>(ICollection<T> entities, string tableName, string[] colu
103103
104104
105105 SqlCommand cmd = GetSqlCommand ( ) ;
106- SqlBulkCopy copy = new SqlBulkCopy ( sqlConnection , update || identity ? SqlBulkCopyOptions . KeepIdentity : SqlBulkCopyOptions . Default , sqlTransaction ) ;
106+ SqlBulkCopy copy = new SqlBulkCopy ( SqlConnection , update || identity ? SqlBulkCopyOptions . KeepIdentity : SqlBulkCopyOptions . Default , sqlTransaction ) ;
107107 copy . BulkCopyTimeout = bulkCopyTimeout ;
108108
109109 try
@@ -1191,9 +1191,9 @@ private SqlCommand GetSqlCommand()
11911191 {
11921192 SqlCommand sqlCommand ;
11931193 if ( sqlTransaction != null && sqlTransaction . Connection != null )
1194- sqlCommand = new SqlCommand ( "" , sqlConnection , sqlTransaction ) ;
1194+ sqlCommand = new SqlCommand ( "" , SqlConnection , sqlTransaction ) ;
11951195 else
1196- sqlCommand = new SqlCommand ( "" , sqlConnection ) ;
1196+ sqlCommand = new SqlCommand ( "" , SqlConnection ) ;
11971197
11981198 sqlCommand . CommandTimeout = timeOut ;
11991199 TryConnectToDatabase ( sqlCommand ) ;
@@ -1222,9 +1222,9 @@ private void TryConnectToDatabase(SqlCommand sqlCommand)
12221222 if ( string . IsNullOrEmpty ( reconnectSqlConnectionString ) )
12231223 throw new Exception ( "Unable to connect to database." ) ;
12241224
1225- sqlConnection = new SqlConnection ( reconnectSqlConnectionString ) ;
1226- sqlConnection . Open ( ) ;
1227- sqlCommand . Connection = sqlConnection ;
1225+ SqlConnection = new SqlConnection ( reconnectSqlConnectionString ) ;
1226+ SqlConnection . Open ( ) ;
1227+ sqlCommand . Connection = SqlConnection ;
12281228 Thread . Sleep ( 1000 ) ;
12291229 }
12301230 }
@@ -1278,7 +1278,7 @@ private void AddParameterToCmd(object fieldObj, SqlCommand cmd, string idColumn)
12781278
12791279 public bool CreateTableClone ( string sourceTableName , string newName , Type entityType )
12801280 {
1281- SQLTableCreator creator = new SQLTableCreator ( sqlConnection , sqlTransaction ) ;
1281+ SQLTableCreator creator = new SQLTableCreator ( SqlConnection , sqlTransaction ) ;
12821282 SqlCommand cmd = GetSqlCommand ( ) ;
12831283
12841284 cmd . CommandText = "SELECT TOP 1 * FROM [" + sourceTableName + "]" ;
0 commit comments