コード例 #1
0
        private static Exception ReportBuildProblem(IEnumerable <KeyValuePair <Type, Type> > views,
                                                    ArgumentException exception)
        {
            var overSizedCounts = views.GroupBy(x => x.Key)
                                  .Select(x => new { x.Key.Name, Count = x.Count() })
                                  .Where(x => x.Count > 1)
                                  .ToList();

            if (overSizedCounts.Count == 0)
            {
                // no idea what the error is - so throw the original
                return(exception.MvxWrap("Unknown problem in ViewModelViewLookup construction"));
            }
            else
            {
                var overSizedText = string.Join(",", overSizedCounts);
                return(exception.MvxWrap(
                           "Problem seen creating View-ViewModel lookup table - you have more than one View registered for the ViewModels: {0}",
                           overSizedText));
            }
        }