Exemple #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (RequestID.Length != 0)
            {
                hash ^= RequestID.GetHashCode();
            }
            if (ReplyChannel.Length != 0)
            {
                hash ^= ReplyChannel.GetHashCode();
            }
            if (Metadata.Length != 0)
            {
                hash ^= Metadata.GetHashCode();
            }
            if (Body.Length != 0)
            {
                hash ^= Body.GetHashCode();
            }
            if (CacheHit != false)
            {
                hash ^= CacheHit.GetHashCode();
            }
            if (Context.Length != 0)
            {
                hash ^= Context.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        /// <summary>
        /// Get an XmlSerializer instance for the
        /// specified parameters. The method will check if
        /// any any previously cached instances are compatible
        /// with the parameters before constructing a new
        /// XmlSerializer instance.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="overrides"></param>
        /// <param name="types"></param>
        /// <param name="root"></param>
        /// <param name="defaultNamespace"></param>
        /// <returns></returns>
        public XmlSerializer GetSerializer(Type type
                                           , XmlAttributeOverrides overrides
                                           , Type[] types
                                           , XmlRootAttribute root
                                           , string defaultNamespace)
        {
            string key = CacheKeyFactory.MakeKey(type
                                                 , overrides
                                                 , types
                                                 , root
                                                 , defaultNamespace);

            XmlSerializer serializer = null;

            if (!serializers.ContainsKey(key))
            {
                lock (syncRoot)
                {
                    if (!serializers.ContainsKey(key))
                    {
                        //stats.IncrementInstanceCount();

                        serializer = new XmlSerializer(type
                                                       , overrides
                                                       , types
                                                       , root
                                                       , defaultNamespace);
                        serializers.Add(key, serializer);

                        NewSerializer?.Invoke(type
                                              , overrides
                                              , types
                                              , root
                                              , defaultNamespace);
                    }     // if( null == Serializers[key] )
                }         // lock
            }             // if( null == Serializers[key] )
            else
            {
                serializer = serializers[key];
                //stats.IncrementHitCount();
                // Tell the listeners that we already
                // had a serializer that matched the attributes
                CacheHit?.Invoke(type
                                 , overrides
                                 , types
                                 , root
                                 , defaultNamespace);
            }

            System.Diagnostics.Debug.Assert(null != serializer);
            return(serializer);
        }
Exemple #3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (RequestMethod.Length != 0)
            {
                hash ^= RequestMethod.GetHashCode();
            }
            if (RequestUrl.Length != 0)
            {
                hash ^= RequestUrl.GetHashCode();
            }
            if (RequestSize != 0L)
            {
                hash ^= RequestSize.GetHashCode();
            }
            if (Status != 0)
            {
                hash ^= Status.GetHashCode();
            }
            if (ResponseSize != 0L)
            {
                hash ^= ResponseSize.GetHashCode();
            }
            if (UserAgent.Length != 0)
            {
                hash ^= UserAgent.GetHashCode();
            }
            if (RemoteIp.Length != 0)
            {
                hash ^= RemoteIp.GetHashCode();
            }
            if (Referer.Length != 0)
            {
                hash ^= Referer.GetHashCode();
            }
            if (CacheHit != false)
            {
                hash ^= CacheHit.GetHashCode();
            }
            if (ValidatedWithOriginServer != false)
            {
                hash ^= ValidatedWithOriginServer.GetHashCode();
            }
            return(hash);
        }
Exemple #4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (RequestMethod.Length != 0)
            {
                hash ^= RequestMethod.GetHashCode();
            }
            if (RequestUrl.Length != 0)
            {
                hash ^= RequestUrl.GetHashCode();
            }
            if (RequestSize != 0L)
            {
                hash ^= RequestSize.GetHashCode();
            }
            if (Status != 0)
            {
                hash ^= Status.GetHashCode();
            }
            if (ResponseSize != 0L)
            {
                hash ^= ResponseSize.GetHashCode();
            }
            if (UserAgent.Length != 0)
            {
                hash ^= UserAgent.GetHashCode();
            }
            if (RemoteIp.Length != 0)
            {
                hash ^= RemoteIp.GetHashCode();
            }
            if (ServerIp.Length != 0)
            {
                hash ^= ServerIp.GetHashCode();
            }
            if (Referer.Length != 0)
            {
                hash ^= Referer.GetHashCode();
            }
            if (latency_ != null)
            {
                hash ^= Latency.GetHashCode();
            }
            if (CacheLookup != false)
            {
                hash ^= CacheLookup.GetHashCode();
            }
            if (CacheHit != false)
            {
                hash ^= CacheHit.GetHashCode();
            }
            if (CacheValidatedWithOriginServer != false)
            {
                hash ^= CacheValidatedWithOriginServer.GetHashCode();
            }
            if (CacheFillBytes != 0L)
            {
                hash ^= CacheFillBytes.GetHashCode();
            }
            if (Protocol.Length != 0)
            {
                hash ^= Protocol.GetHashCode();
            }
            return(hash);
        }