Example #1
0
        ///<summary>
        /// Initializes a new instance of JobClient class, injects data layer with connection and configuration strings.
        /// Only three options are used for the client:
        /// * DBConnectionString
        /// * UseCache
        /// * CacheConfigurationString
        /// * EncryptionKey (optional)
        ///
        /// If UseCache is true, the CacheConfigurationString is required, if false, then it is optional.
        ///</summary>
        ///<param name="config">Setup the database connection string, cache configuration.</param>
        ///
        public JobClient(ClientConfig config)
        {
            if (config == null)
            {
                throw new Exception("Unable to start with no configuration.");
            }

            if (string.IsNullOrWhiteSpace(config.StorageMode))
            {
                throw new Exception("The storage mode must not be empty.");
            }

            if (string.IsNullOrWhiteSpace(config.DBConnectionString))
            {
                throw new Exception("Unable to run without DB storage connection string.");
            }

            if (config.UseCache && string.IsNullOrWhiteSpace(config.CacheConfigurationString))
            {
                throw new Exception("Unable to run without Cache configuration string.");
            }

            this.config = config;

            builder = new ContainerBuilder();
            builder.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource());
            RegisterAssembly.RegisterTypes(builder, config.StorageMode, config.DBConnectionString, config.UseCache, config.CacheConfigurationString, config.EncryptionKey);
            container = builder.Build();

            jobDAL = container.Resolve <IJobDAL>();
        }
Example #2
0
        ///<summary>
        /// Initializes a new instance of JobClient class, injects data layer with connection and configuration strings.
        /// Only three options are used for the client:
        /// * DBConnectionString
        /// * UseCache
        /// * CacheConfigurationString
        /// * EncryptionKey (optional)
        ///
        /// If UseCache is true, the CacheConfigurationString is required, if false, then it is optional.
        ///</summary>
        ///<param name="config">Setup the database connection string, cache configuration.</param>
        ///
        public JobClient(ClientConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("Unable to start with no configuration.");
            }

            if (string.IsNullOrWhiteSpace(config.StorageMode))
            {
                throw new ArgumentNullException("The storage mode must not be empty.");
            }

            if (string.IsNullOrWhiteSpace(config.DBConnectionString))
            {
                throw new ArgumentNullException("Unable to run without DB storage connection string.");
            }

            var builder = new ContainerBuilder();

            builder.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource());
            RegisterAssembly.RegisterTypes(builder, config.StorageMode, config.DBConnectionString, config.EncryptionKey, config.DBAuthKey);
            var container = builder.Build();

            //Use lifetime scope to avoid memory leak http://docs.autofac.org/en/latest/resolve/
            using (var scope = container.BeginLifetimeScope())
            {
                jobDAL = container.Resolve <IJobDAL>();
            }
        }
Example #3
0
 public ProfileController(IAccountDAL accountDAL, IProfileDAL profileDAL, IUserSession userSession, IJobDAL jobDAL, IProfileImageDAL profileImageDAL)
 {
     this.accountDAL      = accountDAL;
     this.profileDAL      = profileDAL;
     this.userSession     = userSession;
     this.jobDAL          = jobDAL;
     this.profileImageDAL = profileImageDAL;
 }
Example #4
0
        public Worker(ServerConfig config, IContainer container, int workerID)
        {
            taskList      = new Dictionary <string, TaskInfo>();
            jobDAL        = container.Resolve <IJobDAL>();
            this.workerID = workerID;
            this.config   = config;

            this.workerProcessID = config.ProcessID + "-" + workerID;
        }
Example #5
0
 public AccountController(IDEMO_DAL demoDal, IAuthProvider authProvider, IJobDAL jobDAL, ITaskDAL taskDAL, ILocationDAL locationDAL, IUserDAL userDAL, IHoursDAL hoursDAL, IPayrollDAL payrollDAL, ILogDAL logDAL)
 {
     this.demoDal      = demoDal;
     this.authProvider = authProvider;
     this.jobDAL       = jobDAL;
     this.taskDAL      = taskDAL;
     this.locationDAL  = locationDAL;
     this.userDAL      = userDAL;
     this.hoursDAL     = hoursDAL;
     this.payrollDAL   = payrollDAL;
     this.logDAL       = logDAL;
 }
Example #6
0
        public Worker(ServerConfig config, IJobDAL jobDAL, int workerID)
        {
            taskList      = new Dictionary <string, TaskInfo>();
            this.jobDAL   = jobDAL;
            this.workerID = workerID;

            this.workerProcessID    = config.ProcessID + "-" + workerID;
            this.maxRunnableJobs    = config.MaxRunnableJobs;
            this.encryptionKey      = config.EncryptionKey;
            this.progressDBInterval = config.ProgressDBInterval;
            this.autoDeletePeriod   = config.AutoDeletePeriod;
            this.autoDeleteStatus   = config.AutoDeleteStatus;
        }
Example #7
0
 public JobClient(IJobDAL jobDAL)
 {
     this.jobDAL = jobDAL;
 }
Example #8
0
 public JobController(IJobDAL jobDAL)
 {
     this.jobDAL = jobDAL;
 }
Example #9
0
 public JobManager(IJobDAL jobDAL)
 {
     _jobDal = jobDAL;
 }