示例#1
0
        private void FindAliasTypes()
        {
            if (Configuration == null)
            {
                return;
            }

            foreach (TypeXml typeXml in Configuration.Types)
            {
                Type type = RuntimeHost.GetNativeType(typeXml.QualifiedName);
                if (type == null)
                {
                    throw new NullReferenceException(string.Format("Type {0} is not found", typeXml.QualifiedName));
                }
                AddType(typeXml.Alias, type);
            }
        }
示例#2
0
        /// <summary>
        /// Adds type to a manager
        /// </summary>
        /// <param name="alias"></param>
        /// <param name="type"></param>
        public void AddType(string alias, Type type)
        {
            Requires.NotNullOrEmpty(alias, "alias");
            Requires.NotNull(type, "type");

            RuntimeHost.Lock();
            try
            {
                if (ShortTypes.ContainsKey(alias))
                {
                    ShortTypes[alias] = type;
                }
                else
                {
                    ShortTypes.Add(alias, type);
                }
            }
            finally
            {
                RuntimeHost.UnLock();
            }
        }