/// <summary> /// Converts from an API object to a PowerShell object /// </summary> /// <param name="v">The object to transform</param> /// <returns>The converted server version capability model</returns> private ServerVersionCapabilityModel CreateSupportedVersionsModel(Management.Sql.Models.ServerVersionCapability v) { ServerVersionCapabilityModel version = new ServerVersionCapabilityModel(); version.ServerVersionName = v.Name; version.Status = v.Status; version.SupportedEditions = v.SupportedEditions.Select(e => { return CreateSupportedEditionModel(e); }).ToList(); return version; }
/// <summary> /// Gets the string formatting of the server version object /// </summary> /// <param name="version">The server version information to format as a string</param> /// <returns>The formatted string containing the server version information</returns> private string GetVersionInformation(ServerVersionCapabilityModel version) { return string.Format("Version: {0} ({1})", version.ServerVersionName, version.Status); }
/// <summary> /// Formats all the supported editions in <paramref name="version"/> as strings prefixed with <paramref name="prefix"/> /// and appends them to the <paramref name="builder"/> /// </summary> /// <param name="depth">How deep to expand the information</param> /// <param name="builder">The string builder to append the information</param> /// <param name="version">The version object to expand and format</param> /// <param name="prefix">The prefix to apply to the information strings</param> private void ExpandEdition(int depth, StringBuilder builder, ServerVersionCapabilityModel version, string prefix) { foreach (var edition in version.SupportedEditions) { string editionInfo = GetEditionInformation(prefix, edition); if (depth > 2) { ExpandServiceObjective(builder, edition, editionInfo); } else { builder.AppendLine(editionInfo); } } }