private object[] PrepareParametersFor(DomainParameter.Group <T> alternative)
        {
            var result = new object[alternative.Parameters.Count];

            foreach (var parameter in alternative.Parametric.Parameters)
            {
                if (parameterValueDatas.TryGetValue(parameter.Name, out var parameterValueData))
                {
                    result[parameter.Index] = alternative.Parameters[parameter.Index].Locate(parameterValueData);
                }
                else if (parameter.IsOptional && parameter.HasDefaultValue)
                {
                    result[parameter.Index] = parameter.DefaultValue;
                }
            }

            return(result);
        }
        private DomainParameter.Group <T> GetFirstAlternativeWithLeastNonMatchedParameters(List <DomainParameter.Group <T> > foundAlternatives)
        {
            DomainParameter.Group <T> result = null;

            var nonMatchCount = int.MaxValue;

            foreach (var alternative in foundAlternatives.OrderByDescending(o => o.Parameters.Count))
            {
                var tempCount = alternative.Parametric.Parameters.Count(p => !parameterValueDatas.ContainsKey(p.Name));

                if (tempCount < nonMatchCount)
                {
                    result        = alternative;
                    nonMatchCount = tempCount;
                }
            }

            return(result);
        }
 private bool MatchesExactlyWithValues(DomainParameter.Group <T> alternative) =>
 alternative.Parametric.Parameters.Count == parameterValueDatas.Count &&
 alternative.Parametric.Parameters.All(p => parameterValueDatas.ContainsKey(p.Name));