示例#1
0
 public DbReaderEx(string id, IOptionsSet options)
     : base(new DbReaderOptions(options))
 {
     _connection = new OleDbConnection(Options.ConnectionString);
     _id         = id;
     _dataset    = null;
 }
        public KafkaTopicReceiveEndpointConfiguration(IKafkaHostConfiguration hostConfiguration, ConsumerConfig consumerConfig, string topic,
                                                      IBusInstance busInstance, IReceiveEndpointConfiguration endpointConfiguration, IHeadersDeserializer headersDeserializer)
            : base(endpointConfiguration)
        {
            _hostConfiguration     = hostConfiguration;
            _busInstance           = busInstance;
            _endpointConfiguration = endpointConfiguration;
            _consumerConfig        = consumerConfig;
            _options = new OptionsSet();
            Topic    = topic;

            if (!SerializationUtils.DeSerializers.IsDefaultKeyType <TKey>())
            {
                SetKeyDeserializer(new MassTransitJsonDeserializer <TKey>());
            }
            SetValueDeserializer(new MassTransitJsonDeserializer <TValue>());
            SetHeadersDeserializer(headersDeserializer);

            CheckpointInterval     = TimeSpan.FromMinutes(1);
            CheckpointMessageCount = 5000;
            MessageLimit           = 10000;
            ConcurrencyLimit       = 1;

            _consumerConfigurator = new PipeConfigurator <ConsumerContext <TKey, TValue> >();
        }
示例#3
0
        public OptionsSet(IOptionsSet other)
        {
            _readonly = false;
            OptionsSet otherOS = other as OptionsSet;

            if (otherOS != null)
            {
                _options = new Dictionary <string, object>(otherOS._options);
            }
            else
            {
                foreach (var pair in other.All())
                {
                    _options.Add(pair);
                }
            }
        }
示例#4
0
        public IFormatReader <IFileOptionsSet> CreateReaderByExtension(string path, IOptionsSet baseOptions = null)
        {
            var extToTypeMap = new Dictionary <string, ReaderType>()
            {
                { ".xls", ReaderType.Excel },
                { ".xlm", ReaderType.Excel },
                { ".xlsx", ReaderType.Excel2007 },
                { ".xlsm", ReaderType.Excel2007 },
                { ".dbf", ReaderType.Dbf },
                { ".csv", ReaderType.Ascii }
            };
            string ext = Path.GetExtension(path).ToLower();

            if (extToTypeMap.ContainsKey(ext))
            {
                return(CreateReader(extToTypeMap[ext], path, baseOptions));
            }
            return(null);
        }
示例#5
0
 public AsciiReader(IOptionsSet options) : base(new AsciiReaderOptions(options))
 {
 }
示例#6
0
 public FileOptionsSet(IOptionsSet other) : base(other)
 {
 }
示例#7
0
 public AsciiReaderOptions(IOptionsSet other) : base(other)
 {
 }
示例#8
0
 public DbfReaderOptions(IOptionsSet other) : base(other)
 {
 }
示例#9
0
        public IFormatReader <IFileOptionsSet> CreateReader(ReaderType type, string path, IOptionsSet baseOptions = null)
        {
            IFormatReader <IFileOptionsSet> result = null;
            FileOptionsSet options = new FileOptionsSet(baseOptions ?? OptionsSet.Empty)
            {
                FilePath = path
            };

            switch (type)
            {
            case ReaderType.Ascii:
                result = new AsciiReader(options);
                break;

            case ReaderType.Excel:
            case ReaderType.Excel2007:
                result = new XlsReader(options);
                break;

            case ReaderType.Dbf:
                result = new DbfReader(options);
                break;

            case ReaderType.Db:
                throw new InvalidOperationException("use CreateDbReader()");

            default:
                throw new UnimplementedReaderTypeException(type);
            }
            return(result);
        }
示例#10
0
        public IEnumerable <IFormatReader <IFileOptionsSet> > CreateDirectoryReader(string path, string pattern = null, IOptionsSet baseOptions = null)
        {
            if (String.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException("path");
            }
            if (Path.HasExtension(path))
            {
                path = Path.GetDirectoryName(path);
            }
            Regex re    = (String.IsNullOrEmpty(pattern) ? null : new Regex(pattern, RegexOptions.IgnoreCase));
            var   files = Directory.GetFiles(path, "*.*", SearchOption.TopDirectoryOnly);

            foreach (var filePath in files)
            {
                if (re == null || re.IsMatch(filePath))
                {
                    var reader = CreateReaderByExtension(filePath, baseOptions);
                    if (reader != null)
                    {
                        yield return(reader);
                    }
                }
            }
        }
示例#11
0
 public XlsReader(IOptionsSet options) : base(new XlsReaderOptions(options))
 {
 }
示例#12
0
 public DbfReader(IOptionsSet options) : base(new DbfReaderOptions(options))
 {
 }
示例#13
0
 public XlsReaderOptions(IOptionsSet other) : base(other)
 {
 }
示例#14
0
 private OptionsSet(IOptionsSet other, bool isReadonly)
     : this(other)
 {
     _readonly = isReadonly;
 }