コード例 #1
0
        public ServerManager(IServiceMessageProcessor serviceMessageProcessor, ITaskRepository taskRepository, IUnitOfWorkFactory unitOfWorkFactory, IServerRepository serverRepository, IContextSettings contextSettings, ServerManagerConfiguration serverManagerConfiguration)
            : base(serverManagerConfiguration)
        {
            if (serviceMessageProcessor == null)
            {
                throw new ArgumentNullException(nameof(serviceMessageProcessor));
            }
            if (taskRepository == null)
            {
                throw new ArgumentNullException(nameof(taskRepository));
            }
            if (unitOfWorkFactory == null)
            {
                throw new ArgumentNullException(nameof(unitOfWorkFactory));
            }
            if (contextSettings == null)
            {
                throw new ArgumentNullException(nameof(contextSettings));
            }
            if (serverRepository == null)
            {
                throw new ArgumentNullException(nameof(serverRepository));
            }

            this.serviceMessageProcessor = serviceMessageProcessor;
            this.taskRepository          = taskRepository;
            this.unitOfWorkFactory       = unitOfWorkFactory;
            this.contextSettings         = contextSettings;
            this.serverRepository        = serverRepository;

            queues = managerConfiguration.Queues;
            queues.Add("default");
        }
コード例 #2
0
        public ClientManager(ITaskRepository taskRepository, IExpressionConverter expressionConverter, IJsonConverter jsonConverter, IUnitOfWorkFactory unitOfWorkFactory, IContextSettings contextSettings, ClientManagerConfiguration managerConfiguration) : base(managerConfiguration)
        {
            if (taskRepository == null)
            {
                throw new ArgumentNullException(nameof(taskRepository));
            }
            if (expressionConverter == null)
            {
                throw new ArgumentNullException(nameof(expressionConverter));
            }
            if (jsonConverter == null)
            {
                throw new ArgumentNullException(nameof(jsonConverter));
            }
            if (unitOfWorkFactory == null)
            {
                throw new ArgumentNullException(nameof(unitOfWorkFactory));
            }
            if (contextSettings == null)
            {
                throw new ArgumentNullException(nameof(contextSettings));
            }

            this.taskRepository      = taskRepository;
            this.expressionConverter = expressionConverter;
            this.jsonConverter       = jsonConverter;
            this.unitOfWorkFactory   = unitOfWorkFactory;
            this.contextSettings     = contextSettings;
        }
コード例 #3
0
        public TaskManager(IScheduleRepository scheduleRepository, ITaskRepository taskRepository, IJsonConverter jsonConverter, ITaskBuilder taskBuilder, ITaskProcessing taskProcessing, IServiceMessageProcessor serviceMessageProcessor, IUnitOfWorkFactory unitOfWorkFactory, IContextSettings contextSettings, TaskManagerConfiguration managerConfiguration) : base(managerConfiguration)
        {
            if (scheduleRepository == null)
            {
                throw new ArgumentNullException(nameof(scheduleRepository));
            }
            if (taskRepository == null)
            {
                throw new ArgumentNullException(nameof(taskRepository));
            }
            if (jsonConverter == null)
            {
                throw new ArgumentNullException(nameof(jsonConverter));
            }
            if (taskBuilder == null)
            {
                throw new ArgumentNullException(nameof(taskBuilder));
            }
            if (taskProcessing == null)
            {
                throw new ArgumentNullException(nameof(taskProcessing));
            }
            if (serviceMessageProcessor == null)
            {
                throw new ArgumentNullException(nameof(serviceMessageProcessor));
            }
            if (unitOfWorkFactory == null)
            {
                throw new ArgumentNullException(nameof(unitOfWorkFactory));
            }
            if (contextSettings == null)
            {
                throw new ArgumentNullException(nameof(contextSettings));
            }

            this.scheduleRepository = scheduleRepository;
            this.taskRepository     = taskRepository;
            this.jsonConverter      = jsonConverter;
            this.taskBuilder        = taskBuilder;
            this.taskProcessing     = taskProcessing;
            this.unitOfWorkFactory  = unitOfWorkFactory;
            this.contextSettings    = contextSettings;

            ServiceMessageHandlerId = Guid.NewGuid();
            serviceMessageProcessor.RegisteredServiceMessageHandler(this);

            taskProcessing.OnTaskProcessed += OnTaskProcessed;
        }
コード例 #4
0
 public ScheduleRepository(IContextSettings contextSettings, IDataContextFactory dataContextFactory) : base(contextSettings, dataContextFactory)
 {
 }
コード例 #5
0
 public ServerRepository(IContextSettings contextSettings, IDataContextFactory dataContextFactory) : base(contextSettings, dataContextFactory)
 {
 }
コード例 #6
0
    public async Task Invoke(HttpContext context, IServiceProvider serviceProvider, IHostingEnvironment env, IContextSettings contextSettings)
    {
        var customerName = context.Request.Headers["customer"];
        var customer     = SettingsProvider.Instance.Settings.Customers.FirstOrDefault(c => c.Name == customerName);

        contextSettings.SetCurrentCustomer(customer);
        await _next.Invoke(context);
    }
コード例 #7
0
 public IndexModel(IContextSettings settings)
 {
     this.settings = settings;
 }
コード例 #8
0
        public ContactsContext(IContextSettings settings)
        {
            var client = new MongoClient(settings.ConnectionString);

            Database = client.GetDatabase(settings.DatabaseName);
        }