private ConcurrentDictionary <string, HttpControllerDescriptorGroup> InitializeControllerInfoCache() { var mapping = new ConcurrentDictionary <string, HttpControllerDescriptorGroup>(OrdinalIgnoreCase); foreach (var pair in controllerTypeCache.Cache) { var key = pair.Key; var descriptors = new List <HttpControllerDescriptor>(); foreach (var grouping in pair.Value) { foreach (var type in grouping) { descriptors.Add(new HttpControllerDescriptor(configuration, key, type)); } } descriptors.Sort(ByVersion); var descriptorGroup = new HttpControllerDescriptorGroup(configuration, key, descriptors.ToArray()); mapping.TryAdd(key, descriptorGroup); } return(mapping); }
ConcurrentDictionary <string, HttpControllerDescriptorGroup> InitializeControllerInfoCache() { var options = configuration.GetApiVersioningOptions(); var implicitVersionModel = new ApiVersionModel(options.DefaultApiVersion); var conventions = options.Conventions; var actionSelector = configuration.Services.GetActionSelector(); var mapping = new ConcurrentDictionary <string, HttpControllerDescriptorGroup>(OrdinalIgnoreCase); foreach (var pair in controllerTypeCache.Cache) { var key = pair.Key; var descriptors = new List <HttpControllerDescriptor>(); foreach (var grouping in pair.Value) { foreach (var type in grouping) { var descriptor = new HttpControllerDescriptor(configuration, key, type); if (!conventions.ApplyTo(descriptor)) { ApplyAttributeOrImplicitConventions(descriptor, actionSelector, implicitVersionModel); } descriptors.Add(descriptor); } } var innerDescriptors = ApplyCollatedModels(descriptors, actionSelector); var descriptorGroup = new HttpControllerDescriptorGroup(configuration, key, innerDescriptors); mapping.TryAdd(key, descriptorGroup); } return(mapping); }