static ResolvedParameter[] ResolveParameters(object instance, string[] methodArguments, Dictionary <string, object> contextParameters) { var parameters = methodArguments.Select((a, index) => { if (a == "this") { return(ResolvedParameter.New(instance, instance.GetType(), a)); } else { var splitted = a.Split(new[] { "." }, StringSplitOptions.RemoveEmptyEntries); var result = instance; if (contextParameters != null) { var firstSplit = splitted.FirstOrDefault(); if (firstSplit != null && contextParameters.ContainsKey(firstSplit)) { result = contextParameters[firstSplit]; splitted = splitted.Skip(1).ToArray(); } } var resultType = result.GetType(); foreach (var split in splitted) { if (result != null) { var property = resultType.GetProperty(split, BindingFlags.Public | BindingFlags.Instance); if (property != null) { result = property.GetValue(result); resultType = result?.GetType() ?? property.PropertyType; } else { return(ResolvedParameter.Unresolvable(a)); } } else { var property = resultType.GetProperty(split, BindingFlags.Public | BindingFlags.Instance); if (property != null) { resultType = property.PropertyType; } else { resultType = null; break; } } } return(ResolvedParameter.New(result, resultType, a)); } }).ToArray(); return(parameters); }