Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add XML comments to public members (resolves CS1591 warnings) #225

Open
wants to merge 1 commit into
base: v8/dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Umbraco.ModelsBuilder/Building/TextBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,20 @@ private void WriteContentType(StringBuilder sb, TypeModel type)
// as 'new' since parent has its own - or maybe not - disable warning
sb.Append("\t\t// helpers\n");
sb.Append("#pragma warning disable 0109 // new is redundant\n");
sb.AppendFormat("\t\t/// <summary>{0}</summary>\n", XmlCommentString("The alias of the model type."));
WriteGeneratedCodeAttribute(sb, "\t\t");
sb.AppendFormat("\t\tpublic new const string ModelTypeAlias = \"{0}\";\n",
type.Alias);
var itemType = type.IsElement ? TypeModel.ItemTypes.Content : type.ItemType; // fixme
sb.AppendFormat("\t\t/// <summary>{0}</summary>\n", XmlCommentString("The <see cref=\"PublishedItemType\"/> this model represents."));
WriteGeneratedCodeAttribute(sb, "\t\t");
sb.AppendFormat("\t\tpublic new const PublishedItemType ModelItemType = PublishedItemType.{0};\n",
itemType);
sb.AppendFormat("\t\t/// <summary>{0}</summary>\n", XmlCommentString("Gets the <see cref=\"IPublishedContentType\"/> of the model type."));
WriteGeneratedCodeAttribute(sb, "\t\t");
sb.Append("\t\tpublic new static IPublishedContentType GetModelContentType()\n");
sb.Append("\t\t\t=> PublishedModelUtility.GetModelContentType(ModelItemType, ModelTypeAlias);\n");
sb.AppendFormat("\t\t/// <summary>{0}</summary>\n", XmlCommentString("Gets the <see cref=\"IPublishedPropertyType\"/> for a model property based on the provided expression."));
WriteGeneratedCodeAttribute(sb, "\t\t");
sb.AppendFormat("\t\tpublic static IPublishedPropertyType GetModelPropertyType<TValue>(Expression<Func<{0}, TValue>> selector)\n",
type.ClrName);
Expand All @@ -213,7 +217,7 @@ private void WriteContentType(StringBuilder sb, TypeModel type)

// write the ctor
if (!type.HasCtor)
sb.AppendFormat("\t\t// ctor\n\t\tpublic {0}(IPublished{1} content)\n\t\t\t: base(content)\n\t\t{{ }}\n\n",
sb.AppendFormat("\t\t// ctor\n\t\t/// <inheritdoc />\n\t\tpublic {0}(IPublished{1} content)\n\t\t\t: base(content)\n\t\t{{ }}\n\n",
type.ClrName, type.IsElement ? "Element" : "Content");

// write the properties
Expand Down