コード例 #1
0
        private IDataContainer ProcessInternal(IDataContainer dataContainer)
        {
            var allData = dataContainer.ToArray();

            // Set new data to keep data container's meta information.
            dataContainer.Clear();

            //Parallel.ForEach(allData, data =>
            //{
            //    IData processedData = null;
            //    try
            //    {
            //        processedData = Process(data);
            //    }
            //    catch (Exception e)
            //    {
            //        Log("Processing error {0}", e.ToString());
            //    }

            //    if (processedData == null)
            //        return;

            //    dataContainer.Add(processedData);
            //});

            foreach (var data in allData)
            {
                IData processedData = null;
                try
                {
                    processedData = Process(data);
                }
                catch (Exception e)
                {
                    LogFormat("Processing error {0}", e.ToString());
                }

                if (processedData == null)
                {
                    continue;
                }

                dataContainer.Add(processedData);
            }
            ;

            return(dataContainer.Any() ? dataContainer : null);
        }
コード例 #2
0
        public override IDataContainer PreProcess(IDataContainer dataContainer)
        {
            var push = false;
            Parallel.ForEach(StagedData, staged =>
            {
                if (dataContainer.Any(d => d.Source.Equals(staged.Source)))
                push = true;
            });

            if (push)
                Push();

            //foreach (var data in dataContainer.OfType<BlobData>())
            //    Stage(data);

            Stage(dataContainer.ToArray());

            return null;
        }
コード例 #3
0
        public override IDataContainer PreProcess(IDataContainer dataContainer)
        {
            var push = false;

            Parallel.ForEach(StagedData, staged =>
            {
                if (dataContainer.Any(d => d.Source.Equals(staged.Source)))
                {
                    push = true;
                }
            });

            if (push)
            {
                Push();
            }

            //foreach (var data in dataContainer.OfType<BlobData>())
            //    Stage(data);

            Stage(dataContainer.ToArray());

            return(null);
        }
コード例 #4
0
        private IDataContainer ProcessInternal(IDataContainer dataContainer)
        {
            var allData = dataContainer.ToArray();

            // Set new data to keep data container's meta information.
            dataContainer.Clear();

            //Parallel.ForEach(allData, data =>
            //{
            //    IData processedData = null;
            //    try
            //    {
            //        processedData = Process(data);
            //    }
            //    catch (Exception e)
            //    {
            //        Log("Processing error {0}", e.ToString());
            //    }

            //    if (processedData == null)
            //        return;

            //    dataContainer.Add(processedData);
            //});

            foreach (var data in allData)
            {
                IData processedData = null;
                try
                {
                    processedData = Process(data);
                }
                catch (Exception e)
                {
                    LogFormat("Processing error {0}", e.ToString());
                }

                if (processedData == null)
                    continue;

                dataContainer.Add(processedData);
            };

            return dataContainer.Any() ? dataContainer : null;
        }