private object ResolveParameters(BindingContext context, HashParametersExpression hpex) { var parameters = new HashParameterDictionary(); foreach (var parameter in hpex.Parameters) { var path = parameter.Value as PathExpression; if (path != null) { parameters.Add(parameter.Key, ResolvePath(context, path.Path)); } else { parameters.Add(parameter.Key, parameter.Value); } } return(parameters); }
private static void PopulateHash(HashParameterDictionary hash, object from, ICompiledHandlebarsConfiguration configuration) { var descriptor = ObjectDescriptor.Create(from, configuration); var accessor = descriptor.MemberAccessor; var properties = descriptor.GetProperties(descriptor, from); var enumerator = properties.GetEnumerator(); while (enumerator.MoveNext()) { var segment = ChainSegment.Create(enumerator.Current); if (hash.ContainsKey(segment)) { continue; } if (!accessor.TryGetValue(@from, segment, out var value)) { continue; } hash[segment] = value; } }