public static string Evaluate(ITagWithVariable tag, TagModel model) { object result = tag.InternalEvaluate(model); string var = tag.GetAutoValueAsString("Var", model); string scope = tag.GetAutoValueAsString("Scope", model); model[scope + "." + var] = result; return String.Empty; }
public static string EvaluateOptional(ITagWithVariable tag, TagModel model) { object result = tag.InternalEvaluate(model); if (tag.Var != null) { string var = tag.GetAutoValueAsString("Var", model); string scope = tag.GetAutoValueAsString("Scope", model); model[scope + "." + var] = result; return String.Empty; } return result != null ? result.ToString() : String.Empty; }
public static string EvaluateOptional(ITagWithVariable tag, TagModel model) { var result = tag.InternalEvaluate(model); if (tag.Var != null) { var var = tag.GetAutoValueAsString("Var", model); var scope = tag.GetAutoValueAsString("Scope", model); model[scope + "." + var] = result; } var postTag = tag as ITagWithVariableAndPostEvaluate; postTag?.PostEvaluate(model, result); return(tag.Var == null ? (result?.ToString() ?? string.Empty) : string.Empty); }
public static string Evaluate(ITagWithVariable tag, TagModel model, bool naturalLanguage = false) { var result = tag.InternalEvaluate(model); var var = tag.GetAutoValueAsString("Var", model); if (naturalLanguage) { var = LanguageHelper.CamelCaseAttribute(var); } var scope = tag.GetAutoValueAs <VariableScope>("Scope", model); if (scope != VariableScope.Page || !model.TryUpdateTag(var, result)) { model[scope + "." + var] = result; } var postTag = tag as ITagWithVariableAndPostEvaluate; postTag?.PostEvaluate(model, result); return(string.Empty); }