Пример #1
0
        public void UnmapPinningRule(WebMap webMap)
        {
            if (webMap.Section?.Template == null)
            {
                // if the Blending Point (WebSection) or the Surface (WebTemplate) was deleted earlier
                return;
            }
            string token  = webMap.GetMappingToken();
            string mapUri = webMap.GetMappingUrl();

            Blender.UnmapUri(webMap.ForeignUrl, token);

            if (webMap.Url != null)
            {
                var uriByTokenCount = Blender.ListAll().Where(x => x.Key == token).SelectMany(x => x.Value).Count();
                if (uriByTokenCount == 2) // one URI for empty WebMap's handler and another one for empty WebSection's handler
                {
                    Blender.UnmapUri(mapUri, token);
                    Handle.UnregisterHttpHandler("GET", mapUri);
                }
            }
        }