示例#1
0
        public CustomerInstance GetOrStartCustomerInstance(Uri requestUri)
        {
            if (requestUri == null)
            {
                throw new ArgumentNullException(nameof(requestUri));
            }

            var instanceKey = _customerResolver.CreateInstanceKey(requestUri);

            CustomerInstance customerInstance;

            if (!_customers.TryGetValue(instanceKey, out customerInstance))
            {
                var customer = _customerResolver.ResolveCustomer(instanceKey);

                if (customer != null && customer.Enabled)
                {
                    customerInstance = CustomerInstance.Create(instanceKey, customer);
                    _customers.TryAdd(instanceKey, customerInstance);
                    Start(customerInstance);
                }
            }

            return(customerInstance);
        }
示例#2
0
 public void Execute(CustomerInstance customer)
 {
     Trace.WriteLine($"Customer {customer.Name}: Initializing EF.");
 }
 public SignalRNotificationTransport(CustomerInstance customer)
 {
     _customer = customer;
     _hub      = GlobalHost.ConnectionManager.GetHubContext <NotificationsHub>();
 }
示例#4
0
        private void Start(CustomerInstance instance)
        {
            _startupTasks?.ForEach(t => t.Execute(instance));

            instance.Start();
        }