Esempio n. 1
0
 /// <summary>
 /// Método interno que verifica se existe alguma entrada com a chave informada.
 /// </summary>
 /// <param name="key"></param>
 /// <returns></returns>
 internal override bool ContainsInternal(object key)
 {
     if (_cacheStore == null)
     {
         throw new InvalidOperationException();
     }
     return(_cacheStore.Contains(key));
 }
Esempio n. 2
0
        /// <summary>
        /// Determines whether the cache contains a specific key.
        /// </summary>
        /// <param name="key">The key to locate in the cache.</param>
        /// <returns>true if the cache contains an element
        /// with the specified key; otherwise, false.</returns>
        internal override bool ContainsInternal(object key)
        {
            if (ServerMonitor.MonitorActivity)
            {
                ServerMonitor.LogClientActivity("LocalCache.Cont", "");
            }

            if (_cacheStore == null)
            {
                throw new InvalidOperationException();
            }
            return(_cacheStore.Contains(key));
        }
Esempio n. 3
0
        /// <summary>
        /// Discovers the and serialize.
        /// </summary>
        /// <param name="stream">The stream.</param>
        /// <param name="obj">The object.</param>
        /// <param name="objectType">Type of the object.</param>
        /// <exception cref="System.ArgumentNullException">The <paramref name="stream"/> is <c>null</c>.</exception>
        /// <exception cref="System.ArgumentNullException">The <paramref name="obj"/> is <c>null</c>.</exception>
        /// <exception cref="System.ArgumentNullException">The <paramref name="objectType"/> is <c>null</c>.</exception>
        public static void DiscoverAndSerialize(Stream stream, object obj, Type objectType)
        {
            Argument.IsNotNull("stream", stream);
            Argument.IsNotNull("obj", obj);
            Argument.IsNotNull("objectType", objectType);

            lock (Cache)
            {
                IObjectMetaData objectMetaData;
                if (Cache.Contains(objectType.FullName))
                {
                    objectMetaData = Cache[objectType.FullName];
                }
                else
                {
                    objectMetaData = new ObjectMetaData();
                    DiscoverTypeInfo(objectType, objectMetaData);
                    Cache.Add(objectType.FullName, objectMetaData);
                }

                Serialize(stream, obj, objectMetaData);
            }
        }