Ejemplo n.º 1
0
        public async Task <int> ExecuteAsync(
            CancellationToken cancellationToken = default(CancellationToken))
        {
            TRepositoryFactory repoFactory = default(TRepositoryFactory);

            try
            {
                repoFactory = CreateRepositoryFactoryCallback(Configuration);

                BlockchainProcessor processor = CreateBlockChainProcessor(repoFactory);

                if (TargetConfiguration.ToBlock != null)
                {
                    await processor.ExecuteAsync(TargetConfiguration.ToBlock.Value, cancellationToken, TargetConfiguration.FromBlock);
                }
                else
                {
                    await processor.ExecuteAsync(cancellationToken, TargetConfiguration.FromBlock);
                }

                return(0);
            }
            catch (Exception ex)
            {
                log?.Error(ex);
                if (repoFactory != null)
                {
                    DisposeAction?.Invoke(repoFactory);
                }
                return(1);
            }
        }
Ejemplo n.º 2
0
        public void Dispose()
        {
            if (!IsSingletone && Result is IDisposable disposable)
            {
                disposable.Dispose();
            }

            DisposeAction?.Invoke();
        }
Ejemplo n.º 3
0
 public void Dispose()
 {
     DisposeAction.Invoke();
     DisposableLock.Dispose();
 }
Ejemplo n.º 4
0
 public void Dispose() => _dispose?.Invoke(value: _value, explicitDispose: true);