示例#1
0
        /// <summary>
        /// Closes the WMC ObjectStore with the option to dispose the ObjectStore
        /// </summary>
        /// <param name="dispose">true = dispose ObjectStore</param>
        public static void Close(bool dispose = false)
        {
            if (objectStore != null)
            {
                objectStore.StoreExpired -= WmcObjectStore_StoreExpired;
                ObjectStore.ReleaseObjectStoreReference();
            }
            wmcMergedLineup = null;

            try
            {
                if (dispose)
                {
                    objectStore?.Dispose();
                }
            }
            catch (Exception ex)
            {
                Logger.WriteInformation($"Exception thrown while trying to dispose of ObjectStore. {ex.Message}\n{ex.StackTrace}");
            }
            objectStore = null;
            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();
        }
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        /// <filterpriority>2</filterpriority>
        public void Dispose()
        {
            Setup.Dispose();
            ObjectStore.Dispose();

            Log.Trace("LeanEngineAlgorithmHandlers.Dispose(): Disposed of algorithm handlers.");
        }