/// <summary> /// Create a new instance with the specified merge fields. /// </summary> /// <param name="mergeFields"></param> /// <returns></returns> public static LavaRenderContext FromMergeValues(LavaDataDictionary mergeFields) { var newContext = new LavaRenderContext(); newContext.SetMergeFields(mergeFields); return(newContext); }
/// <summary> /// Creates a new render context instance. /// </summary> /// <param name="mergeFields"></param> /// <param name="enabledCommands"></param> /// <returns></returns> /// <remarks>This method overload exists to disambiguate calls using the LavaDataDictionary parameter.</remarks> public static ILavaRenderContext NewRenderContext(LavaDataDictionary mergeFields, IEnumerable <string> enabledCommands = null) { if (_engine == null) { return(null); } return(_engine.NewRenderContext(mergeFields, enabledCommands)); }
public void SetMergeFields(LavaDataDictionary fieldValues) { if (fieldValues == null) { return; } foreach (var key in fieldValues.AvailableKeys) { _mergeFields.SetValue(key, fieldValues.GetValue(key)); } }
/// <summary> /// Sets a collection of named values for internal use only. /// Internal values are not available to be resolved in the Lava Template. /// </summary> /// <param name="values"></param> public void SetInternalFields(LavaDataDictionary values) { SetInternalFields(values as IDictionary <string, object>); }
/// <summary> /// Sets the user-defined variables in the current context that are internally available to custom filters and tags. /// </summary> /// <param name="fieldValues"></param> /// <remarks>This method overload exists to disambiguate calls using the LavaDataDictionary parameter.</remarks> public void SetMergeFields(LavaDataDictionary fieldValues) { SetMergeFields((ILavaDataDictionary)fieldValues); }
/// <summary> /// Create a new template context and add the specified merge fields. /// </summary> /// <param name="mergeFields"></param> /// <returns></returns> public ILavaRenderContext NewRenderContext(LavaDataDictionary mergeFields, IEnumerable <string> enabledCommands = null) { // This method exists as a convenience to disambiguate method calls using the LavaDataDictionary parameter, because // it supports both the ILavaDataDictionary and IDictionary<string, object> interfaces. return(NewRenderContext(( ILavaDataDictionary )mergeFields, enabledCommands)); }