Exemplo n.º 1
0
 public void ExecuteAsync()
 {
     NLogStart();
     while (!ReadCompletedFunc.Invoke())
     {
         Buffer.Post(ReadFunc.Invoke());
     }
     Buffer.Complete();
     NLogFinish();
 }
Exemplo n.º 2
0
 public override void Execute()
 {
     NLogStart();
     while (!ReadCompletedFunc.Invoke())
     {
         Buffer.Post(ReadFunc.Invoke());
         LogProgress(1);
     }
     Buffer.Complete();
     NLogFinish();
 }
Exemplo n.º 3
0
 public void PostAll()
 {
     NLogStart();
     while (!ReadCompletedFunc.Invoke())
     {
         Buffer.Post(ReadFunc.Invoke());
         LogProgress(1);
     }
     Buffer.Complete();
     NLogFinish();
 }
Exemplo n.º 4
0
 public override void Execute()
 {
     NLogStart();
     while (!ReadCompletedFunc.Invoke())
     {
         try
         {
             Buffer.SendAsync(ReadFunc.Invoke()).Wait();
         }
         catch (Exception e)
         {
             if (!ErrorHandler.HasErrorBuffer)
             {
                 throw e;
             }
             ErrorHandler.Send(e, e.Message);
         }
         LogProgress();
     }
     Buffer.Complete();
     NLogFinish();
 }
Exemplo n.º 5
0
        private void ReadAllRecords()
        {
            while (!ReadingCompleted.Invoke(ProgressCount))
            {
                TOutput result = default;
                try
                {
                    result = ReadFunc.Invoke(ProgressCount);
                    if (!Buffer.SendAsync(result).Result)
                    {
                        throw new ETLBoxException("Buffer already completed or faulted!", this.Exception);
                    }
                }
                catch (ETLBoxException) { throw; }
                catch (Exception e)
                {
                    ThrowOrRedirectError(e, e.Message);
                }

                LogProgress();
            }
        }
Exemplo n.º 6
0
        public virtual object GetValue(string value)
        {
            if (ReadFunc != null)
            {
                return(ReadFunc.Invoke(value));
            }

            if (_type == typeof(string))
            {
                return(value);
            }

            if (_type == typeof(bool))
            {
                if (value == "1")
                {
                    return(true);
                }
                if (value == "0")
                {
                    return(false);
                }
                throw new FormatException("The value was not 0 or 1 where a boolean was expected");
            }
            if (_type == typeof(Colour) || _type == typeof(Colour?))
            {
                return(Colour.Parse(value));
            }

            if (DefaultValue is Enum)
            {
                return(Enum.Parse(typeof(TValue), value));
            }

            return(Convert.ChangeType(value, _type, Constants.CULTUREINFO));
        }