public virtual void Fill(SqlCommand command, string tableNames, bool includeSchema = true) { FixCommandParameters(command); if (_table != null) { _table.Dispose(); } if (_useCache && DataCache != null) { _table = DataCache.GetTable(command); if (_table != null) { return; } } _table = new DataTable(); using (SqlConnection connection = new SqlConnection(_loginUser.ConnectionString)) { connection.Open(); SqlTransaction transaction = connection.BeginTransaction(IsolationLevel.ReadUncommitted); command.Connection = connection; command.Transaction = transaction; try { using (SqlDataAdapter adapter = new SqlDataAdapter(command)) { if (includeSchema) { adapter.FillSchema(_table, SchemaType.Source); } adapter.Fill(_table); } transaction.Commit(); } catch (Exception e) { transaction.Rollback(); e.Data["CommandText"] = command.CommandText; ExceptionLogs.LogException(LoginUser, e, "BaseCollection.Fill"); throw; } connection.Close(); } if (DataCache != null) { if (tableNames == "") { tableNames = TableName; } DataCache.AddTable(command, tableNames, _cacheExpirationSeconds, _table, _loginUser.OrganizationID); } }