示例#1
0
 public override void Close()
 {
     if (_weCreatedSources)
     {
         _edgeService?.Close();
     }
 }
示例#2
0
        public override async Task <IClientContext> Build()
        {
            var newHeader = string.Join(",",
                                        _attributes.Select((e) => e.Key + "=" +
                                                           HttpUtility.UrlEncode(string.Join(",", e.Value))).OrderBy(u => u));

            if (!newHeader.Equals(_xHeader))
            {
                _xHeader = newHeader;
                _repository.NotReady();

                if (_currentEdgeService != null && _currentEdgeService.IsRequiresReplacementOnHeaderChange)
                {
                    _currentEdgeService.Close();
                    _currentEdgeService = null;
                }
            }

            if (_currentEdgeService == null)
            {
                _currentEdgeService = _edgeServiceSource(_repository, _config);
            }

            await _currentEdgeService.ContextChange(_xHeader);

            return(this);
        }