Exemplo n.º 1
0
 internal void OnDeserialized(StreamingContext context)
 {
     UriSchemeKeyedCollection.ValidateBaseAddress(this.baseAddress, "context");
     if (!HostNameComparisonModeHelper.IsDefined(this.HostNameComparisonMode))
     {
         throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("context", System.ServiceModel.SR.GetString("Hosting_BaseUriDeserializedNotValid"));
     }
     this.SetComparisonAddressAndHashCode();
 }
Exemplo n.º 2
0
        internal void OnDeserialized(StreamingContext context)
        {
            UriSchemeKeyedCollection.ValidateBaseAddress(_baseAddress, "context");

            if (!HostNameComparisonModeHelper.IsDefined(HostNameComparisonMode))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("context", SR.Hosting_BaseUriDeserializedNotValid);
            }
            SetComparisonAddressAndHashCode();
        }
Exemplo n.º 3
0
        public void RegisterUri(Uri uri, HostNameComparisonMode hostNameComparisonMode, TItem item)
        {
            Fx.Assert(HostNameComparisonModeHelper.IsDefined(hostNameComparisonMode), "RegisterUri: Invalid HostNameComparisonMode value passed in.");

            using (AsyncLock.TakeLock())
            {
                // Since every newly registered Uri could alter what Prefixes should have matched, we
                // should clear the cache of any existing results and start over
                ClearCache();
                BaseUriWithWildcard          key  = new BaseUriWithWildcard(uri, hostNameComparisonMode);
                SegmentHierarchyNode <TItem> node = FindOrCreateNode(key);
                if (node.Data != null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(
                                                                                                                SR.DuplicateRegistration, uri)));
                }
                node.SetData(item, key);
                count++;
            }
        }