/// <summary>
        /// </summary>
        /// <param name="key"> </param>
        /// <returns> </returns>
        public T LookUpEquivalentKey(string key)
        {
            key = KeyFromName(key);
            T element;

            if (KeyToType.TryGetValue(key, out element))
            {
                return(element);
            }

            return(null);
        }
        /// <summary>
        ///     Add the given type to the schema look up table. If there is an error, it
        ///     adds the error and returns false. otherwise, it adds the type to the lookuptable
        ///     and returns true
        /// </summary>
        public AddErrorKind TryAdd(T type)
        {
            DebugCheck.NotNull(type);

            if (String.IsNullOrEmpty(type.Identity))
            {
                return(AddErrorKind.MissingNameError);
            }

            var key = KeyFromElement(type);
            T   element;

            if (KeyToType.TryGetValue(key, out element))
            {
                return(AddErrorKind.DuplicateNameError);
            }

            KeyToType.Add(key, type);
            _keysInDefOrder.Add(key);

            return(AddErrorKind.Succeeded);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Add the given type to the schema look up table. If there is an error, it
        /// adds the error and returns false. otherwise, it adds the type to the lookuptable
        /// and returns true
        /// </summary>
        public AddErrorKind TryAdd(T type)
        {
            Debug.Assert(type != null, "type parameter is null");

            if (String.IsNullOrEmpty(type.Identity))
            {
                return(AddErrorKind.MissingNameError);
            }

            string key = KeyFromElement(type);
            T      element;

            if (KeyToType.TryGetValue(key, out element))
            {
                return(AddErrorKind.DuplicateNameError);
            }

            KeyToType.Add(key, type);
            _keysInDefOrder.Add(key);

            return(AddErrorKind.Succeeded);
        }
 /// <summary>
 /// </summary>
 /// <param name="key"> </param>
 /// <returns> </returns>
 public bool ContainsKey(string key)
 {
     return(KeyToType.ContainsKey(KeyFromName(key)));
 }