示例#1
0
文件: Value.cs 项目: Ghasan/NxBRE
 /// <summary> Returns a value cast to a specific type
 /// *
 /// </summary>
 /// <param name="aBrc">- The BRERuleContext object
 /// </param>
 /// <param name="aMap">- The Map of parameters from the XML
 /// </param>
 /// <param name="aStep">- The step that it is on
 /// </param>
 /// <returns> The value cast to the specified type
 /// 
 /// </returns>
 public object ExecuteRule(IBRERuleContext aBrc, Hashtable aMap, object aStep)
 {
     if (!aMap.ContainsKey(TYPE))
     {
         throw new BRERuleException("Parameter 'Type' not found");
     }
     else
     {
         if (!aMap.ContainsKey(VALUE))
         {
             ObjectLookup ol = new ObjectLookup();
             object[] arguments = ol.GetArguments(aMap);
             return Reflection.ClassNew((string)aMap[TYPE], arguments);
         }
         return Reflection.CastValue(aMap[VALUE], (string)aMap[TYPE]);
     }
 }
示例#2
0
 /// <summary> Returns a value cast to a specific type
 /// *
 /// </summary>
 /// <param name="aBrc">- The BRERuleContext object
 /// </param>
 /// <param name="aMap">- The Map of parameters from the XML
 /// </param>
 /// <param name="aStep">- The step that it is on
 /// </param>
 /// <returns> The value cast to the specified type
 ///
 /// </returns>
 public object ExecuteRule(IBRERuleContext aBrc, Hashtable aMap, object aStep)
 {
     if (!aMap.ContainsKey(TYPE))
     {
         throw new BRERuleException("Parameter 'Type' not found");
     }
     else
     {
         if (!aMap.ContainsKey(VALUE))
         {
             ObjectLookup ol        = new ObjectLookup();
             object[]     arguments = ol.GetArguments(aMap);
             return(Reflection.ClassNew((string)aMap[TYPE], arguments));
         }
         return(Reflection.CastValue(aMap[VALUE], (string)aMap[TYPE]));
     }
 }