/*Dispose(bool disposing) executes in two distinct scenarios. * // If disposing equals true, the method has been called directly * // or indirectly by a user's code. Managed and unmanaged resources * // can be disposed. * // If disposing equals false, the method has been called by the * // runtime from inside the finalizer and you should not reference * // other objects. Only unmanaged resources can be disposed.*/ /// <summary> /// Disposes of managed & unmanaged resources /// </summary> /// <param name="disposing">True: called directly/indirectly by user's code; False: called by the runtime from inside the finalizer</param> protected virtual void Dispose(bool disposing) { if (!disposed)// Check to see if Dispose has already been called. { // If disposing equals true, dispose all managed and unmanaged resources if (disposing) { GeotabAPI.Dispose(); // Dispose managed resources. } // Call the appropriate methods to clean up unmanaged resources here. // If disposing is false, only the following code is executed. GGP = null; DBP = null; ConStr = null; GeoGoTable = null; AccessDBEntries = null; odometerCalls = null; engineHoursCalls = null; locationCalls = null; driverCalls = null; _deviceCache = null; _deviceNameCache = null; _driverCache = null; DeviceEntriesList = null; DeviceErrorList = null; GeoGoEntries = null; disposed = true;// Note disposing has been done. } }
/// <summary> /// Initializes a <see cref="GeoGoQuery"/> instance /// </summary> /// <param name="GeoGoPage"><see cref="FuelTransPage"/> instanced, assigned to <see cref="GGP"/> & contains <see cref="DBP"/></param> /// <param name="ct">Cancellation Token, assigned to <see cref="CT"/></param> public GeoGoQuery(FuelTransPage GeoGoPage, CancellationToken ct) { GGP = GeoGoPage; DBP = GeoGoPage.DBP; CT = ct; GeotabAPI = new GeotabAPI(Program.API, ct); ConStr = "Provider = Microsoft.ACE.OLEDB.12.0; Data Source = " + DBP.File + "; Persist Security Info = False"; }