Beispiel #1
0
        // Ask the host to get the type specified by typeString. If it fails, try to retrieve it
        // as a type from System.dll. If that fails, return null or throw the original
        // exception as indicated by throwOnError.
        internal static Type GetType(IInternalConfigHost host, string typeString, bool throwOnError)
        {
            Type      type = null;
            Exception originalException = null;

            try
            {
                type = host.GetConfigType(typeString, throwOnError);
            }
            catch (Exception e)
            {
                originalException = e;
            }

            if (type == null)
            {
                type = GetImplicitType(typeString);
                if ((type == null) && (originalException != null))
                {
                    throw originalException;
                }
            }

            return(type);
        }
Beispiel #2
0
 public virtual object CreateInstance()
 {
     if (Type == null)
     {
         Type = ConfigHost.GetConfigType(TypeName, true);
     }
     return(Activator.CreateInstance(Type, true));
 }
Beispiel #3
0
        // Ask the host to get the type specified by typeString. If it fails, try to retrieve it
        // as a type from System.dll. If that fails, return null or throw the original
        // exception as indicated by throwOnError.
        internal static Type GetType(IInternalConfigHost host, string typeString, bool throwOnError)
        {
            Type type;

            try
            {
                type = host.GetConfigType(typeString, throwOnError);
            }
            catch
            {
                type = GetImplicitType(typeString);
                if (type == null)
                {
                    throw;
                }
            }

            return(type ?? GetImplicitType(typeString));
        }
        static internal Type GetTypeWithReflectionPermission(IInternalConfigHost host, string typeString, bool throwOnError) {
            Type type = null;
            Exception originalException = null;

            try {
                type = host.GetConfigType(typeString, throwOnError);
            }
            catch (Exception e) {
                originalException = e;
            }

            if (type == null) {
                type = GetLegacyType(typeString);
                if (type == null && originalException != null) {
                    throw originalException;
                }
            }

            return type;
        }
Beispiel #5
0
        //
        // Ask the host to get the type specified by typeString. If it fails, try to retrieve it
        // as a type from System.dll. If that fails, return null or throw the original
        // exception as indicated by throwOnError.
        //
        static internal Type GetTypeWithReflectionPermission(IInternalConfigHost host, string typeString, bool throwOnError)
        {
            Type      type = null;
            Exception originalException = null;

            try {
                type = host.GetConfigType(typeString, throwOnError);
            }
            catch (Exception e) {
                originalException = e;
            }

            if (type == null)
            {
                type = GetLegacyType(typeString);
                if (type == null && originalException != null)
                {
                    throw originalException;
                }
            }

            return(type);
        }
        internal static Type GetTypeWithReflectionPermission(IInternalConfigHost host, string typeString, bool throwOnError)
        {
            Type      configType = null;
            Exception exception  = null;

            try
            {
                configType = host.GetConfigType(typeString, throwOnError);
            }
            catch (Exception exception2)
            {
                exception = exception2;
            }
            if (configType == null)
            {
                configType = GetLegacyType(typeString);
                if ((configType == null) && (exception != null))
                {
                    throw exception;
                }
            }
            return(configType);
        }
 public virtual Type GetConfigType(string typeName, bool throwOnError)
 {
     return(host.GetConfigType(typeName, throwOnError));
 }