/// <summary> Returns a value cast to a specific type /// * /// </summary> /// <param name="aBrc">- The BRERuleContext object /// </param> /// <param name="aMap">- The IDictionary 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, IDictionary aMap, object aStep) { if (!aMap.Contains(TYPE)) { throw new BRERuleException("Parameter 'Type' not found"); } else { if (!aMap.Contains(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]); } }
/// <summary> Returns a value cast to a specific type /// * /// </summary> /// <param name="aBrc">- The BRERuleContext object /// </param> /// <param name="aMap">- The IDictionary 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, IDictionary aMap, object aStep) { if (!aMap.Contains(TYPE)) { throw new BRERuleException("Parameter 'Type' not found"); } else { if (!aMap.Contains(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])); } }
/// <summary> Returns a value cast to a specific type /// * /// </summary> /// <param name="aBrc">- The BRERuleContext object /// </param> /// <param name="aMap">- The IDictionary 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, IDictionary aMap, object aStep) { if (!aMap.Contains(TYPE)) { throw new BRERuleException("Parameter 'Type' not found"); } else { var type = (string)aMap[TYPE]; if (aMap.Contains(VALUE)) { return(Reflection.CastValue(aMap[VALUE], type)); } var ol = new ObjectLookup(); var arguments = ol.GetArguments(aMap); return(CreateValue(type, arguments)); } }