Пример #1
0
        public CustomerCodeInstance Get(IIdentityProvider provider, IConnectionProvider connectionProvider)
        {
            var customerCode            = provider.Identity?.CustomerCode;
            CustomerCodeInstance result =
                GetCustomerCodeInstance(connectionProvider, customerCode);

            return(result);
        }
Пример #2
0
        private CustomerCodeInstance GetCustomerCodeInstance(IConnectionProvider connectionProvider, string customerCode)
        {
            CustomerCodeInstance result = null;

            if (customerCode == null || _list.TryGetValue(customerCode, out result))
            {
                return(result);
            }
            lock (Locker)
            {
                if (!_list.TryGetValue(customerCode, out result))
                {
                    result = new CustomerCodeInstance(connectionProvider, _logger);
                    _list.Add(customerCode, result);
                }
            }
            return(result);
        }