コード例 #1
0
        public LoadProcess(XElement config, CancellationTokenSource cancellationTokenSource, ILogger logger, IRowLogger rowlogger = null)
        {
            if (config == null)
            {
                throw new ArgumentNullException("Missing Config");
            }

            _logger = logger;
            _config = config;
            _cancellationTokenSource = cancellationTokenSource;
            _rowlogger = rowlogger;

            var catalog = new AggregateCatalog();

            catalog.Catalogs.Add(new AssemblyCatalog(typeof(LoadProcess).Assembly));
            catalog.Catalogs.Add(new DirectoryCatalog("Engine"));

            _container = new CompositionContainer(catalog);

            var globalDictionaryBuilder = new GlobalDictionaryBuilder();

            _globalData = new GlobalData(globalDictionaryBuilder.Build(_config));
        }
コード例 #2
0
        public void Initialise(XElement config, CancellationTokenSource cancellationTokenSource, ILogger logger, IRowLogger rowlogger)
        {
            if (config == null)
            {
                throw new ConfigException("Missing Config");
            }

            _storedProcedure = config.Attribute("procedure")?.Value;

            if (string.IsNullOrWhiteSpace(_storedProcedure))
            {
                throw new ConfigException("Missing stored procedure name");
            }

            _connStr = config.Attribute("connection")?.Value;

            _parameters = PropertyMapper.Map(config);
        }
コード例 #3
0
        public void Initialise(XElement config, CancellationTokenSource cancellationTokenSource, ILogger logger, IRowLogger rowlogger)
        {
            if (config == null)
            {
                throw new ArgumentNullException("Missing Config");
            }

            _config     = config;
            _logger     = logger;
            _rowloggers = new List <IRowLogger>()
            {
                new RowLogger()
            };

            if (rowlogger != null)
            {
                _rowloggers.Add(rowlogger);
            }

            _cancellationTokenSource = cancellationTokenSource;

            _pipeCount = Convert.ToInt32(_config.Element("pipe")?.Attribute("pipes")?.Value);

            int maxQueue = 50000;

            if (_config.Element("pipe")?.Attribute("queuesize") != null)
            {
                maxQueue = Convert.ToInt32(_config.Element("pipe")?.Attribute("queuesize").Value);
            }

            _inputQueue = new BlockingCollection <Dictionary <string, object> >(maxQueue);
        }
コード例 #4
0
        public void Initialise(XElement config, CancellationTokenSource cancellationTokenSource, ILogger logger, IRowLogger rowlogger)
        {
            if (config == null)
            {
                throw new ConfigException("Missing Config");
            }

            _tableName = config.Attribute("table")?.Value;

            if (string.IsNullOrWhiteSpace(_tableName))
            {
                throw new ConfigException("Missing table");
            }

            _destinationTableName = config.Attribute("destinationtable")?.Value;

            if (string.IsNullOrWhiteSpace(_destinationTableName))
            {
                _destinationTableName = _tableName;
            }

            if (!string.IsNullOrWhiteSpace(config.Attribute("batchsize")?.Value) && !int.TryParse(config.Attribute("batchsize")?.Value, out _batchSize))
            {
                throw new ConfigException("Invalid batch size");
            }

            _connStr = config.Attribute("connection")?.Value;

            _logger = logger;
        }