/// <summary> Finds the mapping for the specified <paramref name="typeName"/>. </summary>
        /// <param name="typeName"> The name of the <see cref="Type"/> to look-up. </param>
        /// <returns>
        ///   A <see cref="string"/> or <see langword="null"/> if the <paramref name="typeName"/> is not mapped
        ///   to a path.
        /// </returns>
        public string FindResource(string typeName)
        {
            if (string.IsNullOrEmpty(typeName))
            {
                return(null);
            }
            Type type = WebTypeUtility.GetType(typeName, true);

            return(FindResource(type));
        }
Exemplo n.º 2
0
        /// <summary>
        ///   Returns an instance the class specified by the <see cref="EditModeControlType"/> property, which will then be used for editing this
        ///   column during edit mode.
        /// </summary>
        public IBusinessObjectBoundEditableWebControl CreateEditModeControl()
        {
            if (string.IsNullOrEmpty(_editModeControlType))
            {
                return(null);
            }

            Type type = WebTypeUtility.GetType(_editModeControlType, true);

            return((IBusinessObjectBoundEditableWebControl)ObjectFactory.Create(type, ParamList.Empty));
        }
Exemplo n.º 3
0
 /// <summary> Gets the <see cref="Type"/> for the specified <paramref name="typeName"/>. </summary>
 /// <include file='..\doc\include\ExecutionEngine\WxeHandler.xml' path='WxeHandler/GetTypeByTypeName/*' />
 protected Type GetTypeByTypeName(string typeName)
 {
     ArgumentUtility.CheckNotNullOrEmpty("typeName", typeName);
     try
     {
         var type = WebTypeUtility.GetType(typeName, true, ignoreCase: true);
         if (!typeof(WxeFunction).IsAssignableFrom(type))
         {
             throw new WxeException(
                       string.Format("The function type '{0}' is invalid. Wxe functions must be derived from '{1}'.", typeName, typeof(WxeFunction).FullName));
         }
         return(type);
     }
     catch (TypeLoadException e)
     {
         throw new WxeException(string.Format("The function type '{0}' is invalid.", typeName), e);
     }
     catch (FileNotFoundException e)
     {
         throw new WxeException(string.Format("The function type '{0}' is invalid.", typeName), e);
     }
 }
Exemplo n.º 4
0
            public virtual Type ResolveFunctionType()
            {
                UrlMappingEntry mapping = UrlMappingConfiguration.Current.Mappings.FindByID(_mappingID);

                bool hasMapping  = mapping != null;
                bool hasTypeName = !string.IsNullOrEmpty(_typeName);

                Type functionType = null;

                if (hasTypeName)
                {
                    functionType = WebTypeUtility.GetType(_typeName, true);
                }

                if (hasMapping)
                {
                    if (functionType == null)
                    {
                        functionType = mapping.FunctionType;
                    }
                    else if (mapping.FunctionType != functionType)
                    {
                        throw new InvalidOperationException(
                                  string.Format(
                                      "The WxeFunctionCommand in has both a MappingID ('{0}') and a TypeName ('{1}') defined, but they resolve to different WxeFunctions.",
                                      _mappingID,
                                      _typeName));
                    }
                }
                else if (!hasTypeName)
                {
                    throw new InvalidOperationException("The WxeFunctionCommand has no valid MappingID or FunctionTypeName specified.");
                }

                return(functionType);
            }