protected virtual void Dispose(bool disposing) { if (!m_disposed) { try { if (disposing) { if ((object)m_stream != null) { m_stream.Dispose(); } if ((object)m_database != null) { m_database.Dispose(); } if ((object)m_client != null) { m_client.Dispose(); } } } finally { m_disposed = true; // Prevent duplicate dispose. } } }
private void Dispose(bool disposing) { if (!m_disposed) { try { if (disposing) { if (m_stream != null) { m_stream.Dispose(); } if (m_database != null) { m_database.Dispose(); } if (m_client != null) { m_client.Dispose(); } } } finally { m_disposed = true; // Prevent duplicate dispose. } } }
public void TestReadData() { var config1 = new HistorianServerDatabaseConfig("Scada", @"c:\temp\Scada\", true); var config2 = new HistorianServerDatabaseConfig("Synchrophasor", @"c:\temp\Synchrophasor\", true); using (HistorianServer server = new HistorianServer()) { server.AddDatabase(config1); server.AddDatabase(config2); using (var client = SnapClient.Connect(server.Host)) { var database = client.GetDatabase <HistorianKey, HistorianValue>("Scada"); TreeStream <HistorianKey, HistorianValue> stream = database.Read(0, 100); stream.Dispose(); database = client.GetDatabase <HistorianKey, HistorianValue>("Synchrophasor"); stream = database.Read(0, 100); stream.Dispose(); } } }
public void TestReadData() { HistorianServerDatabaseConfig config1 = new HistorianServerDatabaseConfig("Scada", @"c:\temp\Scada\", true); HistorianServerDatabaseConfig config2 = new HistorianServerDatabaseConfig("Synchrophasor", @"c:\temp\Synchrophasor\", true); using (HistorianServer server = new HistorianServer(12345)) { server.AddDatabase(config1); server.AddDatabase(config2); using (HistorianClient client = new HistorianClient("127.0.0.1", 12345)) { ClientDatabaseBase <HistorianKey, HistorianValue> database = client.GetDatabase <HistorianKey, HistorianValue>("Scada"); TreeStream <HistorianKey, HistorianValue> stream = database.Read(0, 100); stream.Dispose(); database.Dispose(); database = client.GetDatabase <HistorianKey, HistorianValue>("Synchrophasor"); stream = database.Read(0, 100); stream.Dispose(); database.Dispose(); } } }
/// <summary> /// Releases the unmanaged resources used by the <see cref="ReportHistorianReader"/> object and optionally releases the managed resources. /// </summary> /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param> private void Dispose(bool disposing) { if (m_disposed) { return; } try { if (disposing) { m_stream?.Dispose(); m_database?.Dispose(); m_client?.Dispose(); } } finally { m_disposed = true; // Prevent duplicate dispose. } }