Skip to content

2.1 Extractor

AlvaDamian edited this page Feb 12, 2020 · 1 revision

Extractor

An extractor will take data from a source. Source can be anything, like databases, files, WebServices, etc.

Extractor have to implement IExtractor<SourceType> interface. SourceType is the data type to be extracted from source.

If an extractor uses external resources, it should implement IDisposable and it will be disposed by a processor.

Example

In this simple extractor, data will be in code (hardcoded). It can be extracted from somewhere else.

using System.Collections.Generic;
using TaskETL.Extractors;

namespace Example
{
    public class ItemExtractor : IExtractor<IEnumerable<string>>
    {
        public IEnumerable<string> Extract()
        {
            ICollection<string> ret = new List<string>();

            ret.Add("456 - Pool");
            ret.Add("99-Application");
            ret.Add("7474-     CellPhone");

            return ret;
        }

        public string GetID()
        {
            return "Extractor ID";
        }
    }
}
Clone this wiki locally