public static ApiReferenceBuildOutput FromModel(ItemViewModel vm) { if (vm == null) { return(null); } var output = new ApiReferenceBuildOutput { Uid = vm.Uid, Id = Utility.GetHtmlId(vm.Uid), IsExplicitInterfaceImplementation = vm.IsExplicitInterfaceImplementation, IsExtensionMethod = vm.IsExtensionMethod, Parent = vm.Parent, IsExternal = false, Href = vm.Href, Name = ApiBuildOutputUtility.TransformToLanguagePairList(vm.Name, vm.Names, vm.SupportedLanguages), NameWithType = ApiBuildOutputUtility.TransformToLanguagePairList(vm.NameWithType, vm.NamesWithType, vm.SupportedLanguages), FullName = ApiBuildOutputUtility.TransformToLanguagePairList(vm.FullName, vm.FullNames, vm.SupportedLanguages), Spec = GetSpecNames(ApiBuildOutputUtility.GetXref(vm.Uid, vm.FullName, vm.Name), vm.SupportedLanguages), Source = vm.Source, Documentation = vm.Documentation, AssemblyNameList = vm.AssemblyNameList, NamespaceName = vm.NamespaceName, Remarks = vm.Remarks, Examples = vm.Examples, Overridden = ApiNames.FromUid(vm.Overridden), Overload = ApiNames.FromUid(vm.Overload), SeeAlsos = vm.SeeAlsos?.Select(s => ApiLinkInfoBuildOutput.FromModel(s)).ToList(), Sees = vm.Sees?.Select(s => ApiLinkInfoBuildOutput.FromModel(s)).ToList(), Inheritance = vm.Inheritance?.Select(i => FromUid(i)).ToList(), Implements = vm.Implements?.Select(i => ApiNames.FromUid(i)).ToList(), InheritedMembers = vm.InheritedMembers, ExtensionMethods = vm.ExtensionMethods, Modifiers = vm.Modifiers, Conceptual = vm.Conceptual, Metadata = vm.Metadata, Attributes = vm.Attributes, Syntax = ApiSyntaxBuildOutput.FromModel(vm.Syntax, vm.SupportedLanguages), Exceptions = vm.Exceptions?.Select(s => ApiExceptionInfoBuildOutput.FromModel(s)).ToList(), }; output.Metadata["type"] = vm.Type; output.Metadata["summary"] = vm.Summary; output.Metadata["platform"] = vm.Platform; return(output); }
private static List <ApiLinkInfoBuildOutput> GetLinkInfoList(List <LinkInfo> links, Dictionary <string, ApiReferenceBuildOutput> references, string[] supportedLanguages) { return(links?.Select(l => ApiLinkInfoBuildOutput.FromModel(l, references, supportedLanguages)).ToList()); }