Here are the examples of the csharp api class System.Data.Common.DbDataReader.Dispose() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
39 Examples
0
0
0
0
0
5. Example
View licensepublic void Dispose() { if (!isDisposed) { isDisposed = true; if (!isDataReaderDisposed) { isDataReaderDisposed = true; dataReader.Dispose(); } provider.ConnectionManager.ReleaseConnection(this); } }
0
6. Example
View licenseprotected override void Dispose(bool disposing) { if (disposed) return; if (disposing && rs != null) { rs.Dispose(); rs = null; } disposed = true; }
0
7. Example
View licenseprotected override void Dispose(bool disposing) { if (disposed) return; if (disposing && _reader != null) { _reader.Dispose(); _reader = null; } disposed = true; }
0
8. Example
View licenseprotected override void Dispose(bool disposing) { if (disposing) { InnerDataReader.Dispose(); } base.Dispose(disposing); }
0
9. Example
View licenseprotected override void Dispose(bool disposing) { _reader?.Dispose(); _command?.Dispose(); _reader = null; _command = null; }
0
10. Example
View licenseprivate static void cleanupReader(SqlDataReader reader) { if (reader != null) { if (!reader.IsClosed) { reader.Close(); } reader.Dispose(); } }
0
11. Example
View licensepublic void Dispose() { _sqlDataReader.Dispose(); _dbCommand.Dispose(); _connection.Dispose(); }
0
12. Example
View licenseprivate void dispose_reader() { try { if ( reader_ != null) reader_.Dispose(); if ( cmd_ != null) cmd_.Dispose(); } catch (Exception e) { logger.Error("disposing database connection: " + e.Message); } reader_ = null; cmd_ = null; }
0
13. Example
View licensepublic void Dispose() { if (!_disposed) { _disposed = true; Head.Value = _parent; #if !DOTNETCORE if(_requireThreadAffinity) Thread.EndThreadAffinity(); #endif foreach (var weakReference in _instances) { DbDataReader disposable; if (weakReference.TryGetTarget(out disposable)) disposable.Dispose(); } } }
0
14. Example
View licenseprivate DataTable GetDataTypesCollection(String[] restrictions, OdbcConnection connection){ /n ..... /n //View Source file for more details /n }
0
15. Example
View licenseprotected internal override List<ContentListType> GetContentListTypesInTree(string path) { SqlProcedure cmd = null; SqlDataReader reader = null; var result = new List<ContentListType>(); cmd = new SqlProcedure { CommandText = SELECTCONTENTLISTTYPESSCRIPT, CommandType = CommandType.Text }; cmd.Parameters.Add("@Path", SqlDbType.NVarChar, 450).Value = path; try { reader = cmd.ExecuteReader(); while (reader.Read()) { var id = reader.GetInt32(0); var t = NodeTypeManager.Current.ContentListTypes.GetItemById(id); result.Add(t); } } finally { if (reader != null) reader.Dispose(); if (cmd != null) cmd.Dispose(); } return result; }
0
16. Example
View licenseprivate DataTable GetColumnsCollection(String[] restrictions, OdbcConnection connection){ OdbcCommand command = null; OdbcDataReader dataReader =null; DataTable resultTable = null; const int columnsRestrictionsCount = 4; try { command = GetCommand(connection); String[] allRestrictions = new string[columnsRestrictionsCount]; FillOutRestrictions(columnsRestrictionsCount,restrictions,allRestrictions,OdbcMetaDataCollectionNames.Columns); dataReader = command.ExecuteReaderFromSQLMethod(allRestrictions, ODBC32.SQL_API.SQLCOLUMNS); resultTable = DataTableFromDataReader(dataReader, OdbcMetaDataCollectionNames.Columns); } finally { if (dataReader != null) { dataReader.Dispose(); }; if (command != null) { command.Dispose(); }; } return resultTable; }
0
17. Example
View licenseprivate DataTable GetIndexCollection(String[] restrictions, OdbcConnection connection){ /n ..... /n //View Source file for more details /n }
0
18. Example
View licenseprivate DataTable GetProcedureColumnsCollection(String[] restrictions, OdbcConnection connection,Boo/n ..... /n //View Source file for more details /n }
0
19. Example
View licenseprivate DataTable GetTablesCollection(String[] restrictions, OdbcConnection connection, Boolean isTa/n ..... /n //View Source file for more details /n }
0
20. Example
View licensepublic void CloseReader(DbDataReader reader) { /* This method was added because PrepareCommand don't really prepare the command * with its connection. * In some case we need to manage a reader outsite the command scope. * To do it we need to use the Batcher.ExecuteReader and then we need something * to close the opened reader. */ // TODO NH: Study a way to use directly DbCommand.ExecuteReader() outsite the batcher // An example of it's use is the management of generated ID. if (reader == null) return; var rsw = reader as ResultSetWrapper; var actualReader = rsw == null ? reader : rsw.Target; _readersToClose.Remove(actualReader); var duration = GetReaderStopwatch(actualReader); try { reader.Dispose(); } catch (Exception e) { // NH2205 - prevent exceptions when closing the reader from hiding any original exception Log.Warn("exception closing reader", e); } LogCloseReader(); LogDuration(duration); }
0
21. Example
View licensepublic bool Execute(TInput criteria) { SqlDataReader myReader = null; /n ..... /n //View Source file for more details /n }
0
22. Example
View licenseprotected override void Dispose(bool disposing) { source.Dispose(); base.Dispose(disposing); }
0
23. Example
View licenseprivate DataTable GetProceduresCollection(String[] restrictions, OdbcConnection connection){ /n ..... /n //View Source file for more details /n }
0
24. Example
View license[SuppressMessage("Microsoft.Security", "CA2100:Review SQL queries for security vulnerabilities")] public virtual DbDataReader ExecuteDataReader(string commandText, CommandType commandType, TimeSpan commandTimeout, params DbParameter[] parameters) { if (string.IsNullOrWhiteSpace(commandText)) throw new ArgumentNullException(nameof(commandText)); DbDataReader results = null; try { var open = _explicitlyOpened; OpenConnectionInternal(); using (var command = PrepCommand(Connection, commandText, commandType, commandTimeout, parameters)) { // If the connection was open before execute was called, then do not automatically close connection. results = open ? command.ExecuteReader() : command.ExecuteReader(CommandBehavior.CloseConnection); } } catch { if (results != null && !results.IsClosed) results.Dispose(); // ReSharper disable once ExceptionNotDocumented // ReSharper disable once ThrowingSystemException throw; } return results; }
0
25. Example
View license[SuppressMessage("Microsoft.Security", "CA2100:Review SQL queries for security vulnerabilities")] /n ..... /n //View Source file for more details /n }
0
26. Example
View licenseprotected internal override NodeHead.NodeVersion[] GetNodeVersions(int nodeId) { /n ..... /n //View Source file for more details /n }
0
27. Example
View licenseprivate void InternalFind(TInput criteria, int maxResults, ProcedureQueryCallback<TOutput> cal/n ..... /n //View Source file for more details /n }
0
28. Example
View licensepublic override void ReadInternal(byte[] b, int offset, int length) { if (b.Length == 0) return; if (_command == null || _reader == null || _reader.IsClosed || offset < _position) { _reader?.Dispose(); _command?.Dispose(); _command = new SqlCommand($"SELECT Content FROM {_options.SchemaName}.[FileContents] WHERE Name = @name", _connection); _command.Parameters.AddWithValue("name", _name); _reader = _command.ExecuteReader(CommandBehavior.SequentialAccess); _reader.Read(); } if (false == _reader.HasRows) { return; } if (false == _reader.IsDBNull(0)) { _reader.GetBytes(0, _position, b, offset, length); } _position += length; }
0
29. Example
View licenseprivate NodeHead LoadNodeHead(int nodeId, string path, int versionId) { SqlProce/n ..... /n //View Source file for more details /n }
0
30. Example
View licenseprivate void _Find(TSelectCriteria criteria, int? startIndex, int? maxRows, SelectCallback<TServe/n ..... /n //View Source file for more details /n }
0
31. Example
View licenseList<TOutput> IEnumBroker<TOutput>.Execute() { List<TOutput> /n ..... /n //View Source file for more details /n }
0
32. Example
View licensepublic TServerEntity Load(ServerEntityKey entityRef) { TServerEntity row = null;/n ..... /n //View Source file for more details /n }
0
33. Example
View licensepublic override void CreateOrModify_TablesAndFields(string dataTable, DatasetConfig datasetConfig) /n ..... /n //View Source file for more details /n }
0
34. Example
View licensepublic static IEnumerable<T> ExecuteReader<T>( this DatabaseCommand databaseCommand, Fun/n ..... /n //View Source file for more details /n }
0
35. Example
View licensepublic override bool TableExists(string table) { SqlConnection dbcon = GetLockedConnection(); SqlCommand dbcommand = dbcon.CreateCommand(); dbcommand.CommandText = string.Format("select table_name from information_schema.tables where table_schema=database() and table_name='{0}'", table.ToLower()); var rdr = dbcommand.ExecuteReader(); var ret = false; if (rdr.Read()) { ret = true; } rdr.Close(); rdr.Dispose(); dbcommand.Dispose(); CloseDatabase(dbcon); return ret; }
0
36. Example
View licensepublic static IEnumerable<string> RunMSsqlQuery(List<string> lSQLInput, string sSrcIP, s/n ..... /n //View Source file for more details /n }
0
37. Example
View licenseprotected override async Task<Lease<T>> AcquireLease() { Lease<T&/n ..... /n //View Source file for more details /n }
0
38. Example
View licenseprotected override List<ColumnDefinition> ExtractColumnsFromTable(string tableName) { var defs = new List<ColumnDefinition>(); SqlConnection dbcon = GetLockedConnection(); SqlCommand dbcommand = dbcon.CreateCommand(); dbcommand.CommandText = string.Format("desc {0}", tableName); var rdr = dbcommand.ExecuteReader(); while (rdr.Read()) { var name = rdr["Field"]; var pk = rdr["Key"]; var type = rdr["Type"]; defs.Add(new ColumnDefinition { Name = name.ToString(), IsPrimary = pk.ToString()=="PRI", Type = ConvertTypeToColumnType(type.ToString()) }); } rdr.Close(); rdr.Dispose(); dbcommand.Dispose(); CloseDatabase(dbcon); return defs; }
0
39. Example
View licensepublic static FidoReturnValues GetHostOsInfo(FidoReturnValues lFidoReturnValues, string sConnectionS/n ..... /n //View Source file for more details /n }