Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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));
        }