in src/lib/Microsoft.Fx.Portability/ObjectModel/CloudApiCatalogLookup.cs [32:96]
public CloudApiCatalogLookup(DotNetCatalog catalog, AdditionalDataCatalog extra = null)
{
_lastModified = catalog.LastModified;
_builtBy = catalog.BuiltBy;
// we want to recreate the fast look-up data structures.
_apiMapping = catalog.Apis.AsParallel()
.ToDictionary(key => key.DocId,
#if NETSTANDARD1_3
value => value.Targets.ToDictionary(innerkey => innerkey.Identifier,
#else
value => value.Targets.ToDictionary(innerkey => string.Intern(innerkey.Identifier),
#endif
innervalue => innervalue.Version, StringComparer.OrdinalIgnoreCase));
_apiMetadata = catalog.Apis.AsParallel()
.Where(api => api.Metadata != null)
.ToDictionary(
key => key.DocId,
value => value.Metadata.ToDictionary(
innerKey => innerKey.MetadataKey,
innerValue => innerValue.Value,
StringComparer.Ordinal),
StringComparer.Ordinal);
_publicTargets = catalog.SupportedTargets
.Where(sp => sp.IsReleased)
.Select(sp => sp.DisplayName)
.ToList();
_latestTargetVersion = catalog.SupportedTargets
.GroupBy(sp => sp.DisplayName.Identifier)
.ToDictionary(key => key.Key, value => value.OrderByDescending(p => p.DisplayName.Version).First().DisplayName, StringComparer.OrdinalIgnoreCase);
_allTargets = catalog.SupportedTargets;
_frameworkAssemblies = new HashSet<string>(catalog.FrameworkAssemblyIdenties, StringComparer.OrdinalIgnoreCase);
_docIdToApi = catalog.Apis.ToDictionary(key => key.DocId, key => new ApiDefinition
{
DocId = key.DocId,
Name = key.Name,
#if NETSTANDARD1_3
ReturnType = key.Type,
#else
ReturnType = string.Intern(key.Type),
#endif
FullName = key.FullName,
Parent = key.Parent
});
// Populate the exception list if the additional data catalog contains exceptions.
if (extra != null && extra.Exceptions != null)
{
_apiExceptions = extra.Exceptions.AsParallel()
.Where(api => api.Exceptions != null)
.ToDictionary(
key => key.DocId,
value => value.Exceptions.ToList());
}
else
{
_apiExceptions = new Dictionary<string, List<ApiException>>();
}
}