/// <summary> /// Raises the Executed event and clears the operation cache. /// </summary> /// <param name="e">The ExecutableEventArgs.</param> protected virtual void OnExecuted(ExecutableEventArgs e) { if (clearCache && e.Executable is IOperation operation) { OperationCache cache = new OperationCache(operation); cache.Clear(); } Executed?.Invoke(this, e); }
/// <summary> /// /// </summary> /// <param name="row"></param> /// <param name="cancel"></param> /// <param name="progress"></param> /// <returns></returns> /// <remarks>http://www.csharp-examples.net/dataview-rowfilter/</remarks> protected virtual object GetCachedDataSourceValue(DataRow row, CancellationToken cancel, IProgress <ExecutionProgress> progress) { DataTable dataTable = default(DataTable); if (Parent is IOperation operation) { OperationCache cache = new OperationCache(operation); string cacheKey = string.Format("LookupValue:{0}", dataSource.ID); dataTable = (DataTable)cache[cacheKey]; if (dataTable == default(DataTable)) { dataTable = DataSource.GetDataTable(cancel, progress); cache[cacheKey] = dataTable; } } return(GetDataSourceValue(dataTable, row, cancel, progress)); }