public virtual IEnumerable <IRow> Read()
        {
            Context.Debug(() => $"Running {Transforms.Count} transforms.");
            if (Context.Entity.NeedsUpdate())
            {
                if (Context.Process.Mode != "init")
                {
                    if (Context.Entity.Version != string.Empty)
                    {
                        var version = Context.Entity.GetVersionField();
                        if (version.Type == "byte[]")
                        {
                            var min = Context.Entity.MinVersion == null ? "null" : Utility.BytesToHexViaLookup32((byte[])Context.Entity.MinVersion).TrimStart(new[] { '0' });
                            var max = Context.Entity.MaxVersion == null ? "null" : Utility.BytesToHexViaLookup32((byte[])Context.Entity.MaxVersion).TrimStart(new[] { '0' });
                            Context.Info("Change Detected: Input:{0} > Output:{1}", max, min);
                        }
                        else
                        {
                            Context.Info("Change Detected: Input:{0} > Output:{1}", Context.Entity.MaxVersion ?? "null", Context.Entity.MinVersion ?? "null");
                        }
                    }
                }
                var data = Reader == null?InputProvider.Read() : Reader.Read();

#if NETS10
                // no PLINQ
#else
                if (Context.Entity.Pipeline == "parallel.linq")
                {
                    data = data.AsParallel();
                }
#endif

                if (Transforms.Any())
                {
                    data = Transforms.Aggregate(data, (rows, t) => t.Operate(rows));
                }
                if (Validators.Any())
                {
                    data = Validators.Aggregate(data, (rows, v) => v.Operate(rows));
                }
                return(data);
            }
            Context.Info("Change Detected: No.");
            return(Enumerable.Empty <IRow>());
        }
Пример #2
0
        public virtual IEnumerable <IRow> Read()
        {
            Context.Debug(() => $"Running {Transforms.Count} transforms.");
            if (Context.Entity.NeedsUpdate())
            {
                if (Context.Process.Mode != "init")
                {
                    if (Context.Entity.Version != string.Empty)
                    {
                        if (Context.Entity.GetVersionField().Type == "byte[]")
                        {
                            var min = Context.Entity.MinVersion == null ? "null" : "0x" + string.Format("{0:X}", Utility.BytesToHexString((byte[])Context.Entity.MinVersion).TrimStart(new[] { '0' }));
                            var max = Context.Entity.MaxVersion == null ? "null" : "0x" + string.Format("{0:X}", Utility.BytesToHexString((byte[])Context.Entity.MaxVersion).TrimStart(new[] { '0' }));
                            Context.Info("Change Detected: Input: {0} > Output: {1}", max, min);
                        }
                        else
                        {
                            Context.Info("Change Detected: Input: {0} > Output: {1}", Context.Entity.MaxVersion, Context.Entity.MinVersion);
                        }
                    }
                }
                var data = Reader == null?InputProvider.Read() : Reader.Read();

                if (Transforms.Any())
                {
                    data = Transforms.Aggregate(data, (rows, t) => t.Operate(rows));
                }
                if (Validators.Any())
                {
                    data = Validators.Aggregate(data, (rows, v) => v.Operate(rows));
                }
                return(data);
            }
            Context.Info("Change Detected: No.");
            return(Enumerable.Empty <IRow>());
        }