示例#1
0
 public OutputObject(object data, OutputContractAttribute handler)
 {
     mData = data;
     mHandler = handler;
     mContext = WebContext.Current;
 }
示例#2
0
文件: Utils.cs 项目: CalmGe/Peanut
 private static void LoadController(ControllerAttribute controller, Type type, FilterAttribute[] filters, OutputContractAttribute[] outputs)
 {
     string text = WebContext.Current.Request.ApplicationPath;
     if (!string.IsNullOrEmpty(controller.Path))
     {
         text += controller.Path;
     }
     Type[] nestedTypes = type.GetNestedTypes();
     for (int i = 0; i < nestedTypes.Length; i++)
     {
         Type type2 = nestedTypes[i];
         if (type2.GetInterface("Peanut.IView") != null)
         {
             string text2 = text + type2.Name;
             ActionItem actionItem = new ActionItem(type2);
             if (outputs.Length > 0)
             {
                 actionItem.Output = outputs[0];
             }
             outputs = Functions.GetTypeAttributes<OutputContractAttribute>(type2, true);
             if (outputs.Length > 0)
             {
                 actionItem.Output = outputs[0];
             }
             for (int j = 0; j < filters.Length; j++)
             {
                 FilterAttribute item = filters[j];
                 actionItem.Filters.Add(item);
             }
             FilterAttribute[] typeAttributes = Functions.GetTypeAttributes<FilterAttribute>(type2, true);
             for (int j = 0; j < typeAttributes.Length; j++)
             {
                 FilterAttribute item = typeAttributes[j];
                 actionItem.Filters.Add(item);
             }
             if (Utils.mActions.ContainsKey(text.ToLower()))
             {
                 Utils.mActions[text2.ToLower()] = actionItem;
             }
             else
             {
                 Utils.mActions.Add(text2.ToLower(), actionItem);
             }
             MatchUrlAttribute[] typeAttributes2 = Functions.GetTypeAttributes<MatchUrlAttribute>(type2, false);
             if (typeAttributes2.Length > 0)
             {
                 typeAttributes2[0].Item = actionItem;
                 Utils.mMatchUrls.Add(typeAttributes2[0]);
             }
         }
     }
 }
示例#3
0
 public OutputObject(object data, OutputContractAttribute handler)
 {
     mData    = data;
     mHandler = handler;
     mContext = WebContext.Current;
 }