Exemplo n.º 1
0
        protected internal async override Task <DataReader> OnEnumerateAsync(Rse.Providers.EnumerationContext context, CancellationToken token)
        {
            var storageContext = (EnumerationContext)context;
            var executor       = storageContext.Session.Services.Demand <IProviderExecutor>();

            return(await executor.ExecuteTupleReaderAsync(Request, storageContext.ParameterContext, token).ConfigureAwait(false));
        }
Exemplo n.º 2
0
        /// <inheritdoc/>
        protected override void OnBeforeEnumerate(Rse.Providers.EnumerationContext context)
        {
            base.OnBeforeEnumerate(context);
            switch (Origin.Algorithm)
            {
            case IncludeAlgorithm.Auto:
                var filterData = filterDataSource.Invoke().ToList();
                if (filterData.Count > WellKnown.MaxNumberOfConditions)
                {
                    LockAndStore(context, filterData);
                }
                else
                {
                    context.SetValue(filterDataSource, RowFilterDataName, filterData);
                }
                break;

            case IncludeAlgorithm.ComplexCondition:
                // nothing
                break;

            case IncludeAlgorithm.TemporaryTable:
                LockAndStore(context, filterDataSource.Invoke());
                break;

            default:
                throw new ArgumentOutOfRangeException("Origin.Algorithm");
            }
        }
Exemplo n.º 3
0
        /// <inheritdoc/>
        protected internal override DataReader OnEnumerate(Rse.Providers.EnumerationContext context)
        {
            var storageContext = (EnumerationContext)context;
            var executor       = storageContext.Session.Services.Demand <IProviderExecutor>();

            return(executor.ExecuteTupleReader(Request, storageContext.ParameterContext));
        }
Exemplo n.º 4
0
        protected async override Task <IEnumerable <Tuple> > OnEnumerateAsync(Rse.Providers.EnumerationContext context, CancellationToken token)
        {
            var storageContext = (EnumerationContext)context;
            var executor       = storageContext.Session.Services.Demand <IProviderExecutor>();
            var enumerator     = await executor.ExecuteTupleReaderAsync(Request, token).ConfigureAwait(false);

            return(enumerator.ToEnumerable());
        }
Exemplo n.º 5
0
        /// <inheritdoc/>
        protected override IEnumerable <Tuple> OnEnumerate(Rse.Providers.EnumerationContext context)
        {
            var storageContext = (EnumerationContext)context;
            var executor       = storageContext.Session.Services.Demand <IProviderExecutor>();
            var enumerator     = executor.ExecuteTupleReader(Request);

            using (enumerator) {
                while (enumerator.MoveNext())
                {
                    yield return(enumerator.Current);
                }
            }
        }
        protected bool ClearAndUnlock(Rse.Providers.EnumerationContext context)
        {
            var tableLock = context.GetValue <IDisposable>(this, TemporaryTableLockName);

            if (tableLock == null)
            {
                return(false);
            }
            var storageContext = (EnumerationContext)context;

            using (tableLock)
                storageContext.Session.Services.Demand <IProviderExecutor>().Clear(tableDescriptor, storageContext.ParameterContext);
            return(true);
        }
        protected void LockAndStore(Rse.Providers.EnumerationContext context, IEnumerable <Tuple> data)
        {
            var storageContext = (EnumerationContext)context;
            var tableLock      = DomainHandler.TemporaryTableManager.Acquire(storageContext, tableDescriptor);

            if (tableLock == null)
            {
                return;
            }
            storageContext.SetValue(this, TemporaryTableLockName, tableLock);
            var executor = storageContext.Session.Services.Demand <IProviderExecutor>();

            executor.Store(tableDescriptor, data, storageContext.ParameterContext);
        }
 protected internal override void OnAfterEnumerate(Rse.Providers.EnumerationContext context)
 {
     ClearAndUnlock(context);
     base.OnAfterEnumerate(context);
 }
 /// <inheritdoc/>
 protected internal override void OnBeforeEnumerate(Rse.Providers.EnumerationContext context)
 {
     base.OnBeforeEnumerate(context);
     LockAndStore(context, Source.ToEnumerable(context));
 }
 /// <inheritdoc/>
 protected override void OnBeforeEnumerate(Rse.Providers.EnumerationContext context)
 {
     base.OnBeforeEnumerate(context);
     LockAndStore(context, Source);
 }