public RFServiceEnvironment(string environment, RFEngineDefinition config, string dbConnection)
        {
            _context = new RFComponentContext
            {
                CancellationTokenSource = new CancellationTokenSource(),
                Catalog      = null,
                UserConfig   = new RFCachedUserConfig(dbConnection, environment),
                SystemConfig = new RFSystemConfig
                {
                    Environment    = environment,
                    IntervalLength = config.IntervalSeconds * 1000,
                    ProcessingMode = RFProcessingMode.RFContinuous,
                    DocumentStoreConnectionString = dbConnection,
                    Downtime = RFSettings.GetDowntime()
                }
            };

            RFStatic.Log = new RFLog4NetLog(dbConnection);

            var engine = new RFSimpleEngine(config, _context);

            _context.Engine        = engine;
            _context.Catalog       = new RFSQLCatalog(_context);
            _context.UserLog       = new RFSQLUserLog(_context);
            _context.UserRole      = new RFSQLUserRole(dbConnection);
            _context.DispatchStore = new RFDispatchStoreSQL(_context);

            _workQueue = new RFGraphDispatchQueue(engine.GetWeights(), engine.GetDependencies(), engine.GetExclusiveProcesses(), _context);
            RFEnvironments.LogLicenseInfo(config);
        }
        public RFConsoleEnvironment(string environment, RFEngineDefinition config, string dbConnection)
        {
            _context = new RFComponentContext
            {
                CancellationTokenSource = new CancellationTokenSource(),
                Catalog      = null,
                UserConfig   = new RFCachedUserConfig(dbConnection, environment),
                UserRole     = new RFSQLUserRole(dbConnection),
                SystemConfig = new RFSystemConfig
                {
                    Environment    = environment,
                    ProcessingMode = RFProcessingMode.RFSinglePass,
                    IntervalLength = config.IntervalSeconds,
                    DocumentStoreConnectionString = dbConnection
                }
            };

            if (RFStatic.Log == null)
            {
                RFStatic.Log = new RFLog4NetLog(dbConnection);
            }

            // reuse parent context for database-access, but create a new engine and work queue (for tracking)
            var engine = new RFSimpleEngine(config, _context);

            _context.Catalog          = new RFSQLCatalog(_context);
            _context.ActiveComponents = new List <RFActiveComponent>();
            _context.Engine           = engine;
            _context.UserLog          = new RFSQLUserLog(_context);
            _context.DispatchStore    = new RFDispatchStoreSQL(_context);
            _workQueue = new RFGraphDispatchQueue(engine.GetWeights(), engine.GetDependencies(), engine.GetExclusiveProcesses(), _context);

            RFEnvironments.LogLicenseInfo(config);
        }