diff --git a/src/Mvc/Mvc.ViewFeatures/src/AntiforgeryExtensions.cs b/src/Mvc/Mvc.ViewFeatures/src/AntiforgeryExtensions.cs
index 42470db50468..6faa76a80523 100644
--- a/src/Mvc/Mvc.ViewFeatures/src/AntiforgeryExtensions.cs
+++ b/src/Mvc/Mvc.ViewFeatures/src/AntiforgeryExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) .NET Foundation. All rights reserved.
+// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
@@ -10,6 +10,9 @@
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
+ ///
+ /// Static class that adds extension methods to . This class cannot be inherited.
+ ///
public static class AntiforgeryExtensions
{
///
diff --git a/src/Mvc/Mvc.ViewFeatures/src/CookieTempDataProvider.cs b/src/Mvc/Mvc.ViewFeatures/src/CookieTempDataProvider.cs
index 3b4e40221cdb..ea4c9372f23e 100644
--- a/src/Mvc/Mvc.ViewFeatures/src/CookieTempDataProvider.cs
+++ b/src/Mvc/Mvc.ViewFeatures/src/CookieTempDataProvider.cs
@@ -1,4 +1,4 @@
-// Copyright (c) .NET Foundation. All rights reserved.
+// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
@@ -18,6 +18,9 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
///
public class CookieTempDataProvider : ITempDataProvider
{
+ ///
+ /// The name of the cookie.
+ ///
public static readonly string CookieName = ".AspNetCore.Mvc.CookieTempDataProvider";
private static readonly string Purpose = "Microsoft.AspNetCore.Mvc.CookieTempDataProviderToken.v1";
@@ -27,6 +30,13 @@ public class CookieTempDataProvider : ITempDataProvider
private readonly ChunkingCookieManager _chunkingCookieManager;
private readonly CookieTempDataProviderOptions _options;
+ ///
+ /// Initializes a new instance of .
+ ///
+ /// The .
+ /// The .
+ /// The .
+ /// The .
public CookieTempDataProvider(
IDataProtectionProvider dataProtectionProvider,
ILoggerFactory loggerFactory,
@@ -40,6 +50,11 @@ public CookieTempDataProvider(
_options = options.Value;
}
+ ///
+ /// Loads the temp data from the request.
+ ///
+ /// The .
+ /// The temp data.
public IDictionary LoadTempData(HttpContext context)
{
if (context == null)
@@ -85,6 +100,11 @@ public IDictionary LoadTempData(HttpContext context)
return new Dictionary(StringComparer.OrdinalIgnoreCase);
}
+ ///
+ /// Save the temp data to the request.
+ ///
+ /// The .
+ /// The values.
public void SaveTempData(HttpContext context, IDictionary values)
{
if (context == null)
diff --git a/src/Mvc/Mvc.ViewFeatures/src/DefaultHtmlGenerator.cs b/src/Mvc/Mvc.ViewFeatures/src/DefaultHtmlGenerator.cs
index 76491f0373b3..b90e8af4a4fb 100644
--- a/src/Mvc/Mvc.ViewFeatures/src/DefaultHtmlGenerator.cs
+++ b/src/Mvc/Mvc.ViewFeatures/src/DefaultHtmlGenerator.cs
@@ -20,6 +20,9 @@
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
+ ///
+ /// Default implementation of .
+ ///
public class DefaultHtmlGenerator : IHtmlGenerator
{
private const string HiddenListItem = @"";
@@ -1208,6 +1211,21 @@ protected virtual TagBuilder GenerateFormCore(
return tagBuilder;
}
+ ///
+ /// Generate an input tag.
+ ///
+ /// The .
+ /// The .
+ /// The .
+ /// The expression.
+ /// The value.
+ /// Whether to use view data.
+ /// If the input is checked.
+ /// Whether this should set id.
+ /// Whether this is an explicit value.
+ /// The format.
+ /// The html attributes.
+ ///
protected virtual TagBuilder GenerateInput(
ViewContext viewContext,
InputType inputType,
@@ -1356,6 +1374,13 @@ protected virtual TagBuilder GenerateInput(
return tagBuilder;
}
+ ///
+ /// Generate a link.
+ ///
+ /// The text for the link.
+ /// The url for the link.
+ /// The html attributes.
+ /// The .
protected virtual TagBuilder GenerateLink(
string linkText,
string url,
diff --git a/src/Mvc/Mvc.ViewFeatures/src/DefaultHtmlGeneratorExtensions.cs b/src/Mvc/Mvc.ViewFeatures/src/DefaultHtmlGeneratorExtensions.cs
index fd58824cd0b6..9847421752d3 100644
--- a/src/Mvc/Mvc.ViewFeatures/src/DefaultHtmlGeneratorExtensions.cs
+++ b/src/Mvc/Mvc.ViewFeatures/src/DefaultHtmlGeneratorExtensions.cs
@@ -1,12 +1,27 @@
-// Copyright (c) .NET Foundation. All rights reserved.
+// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
+ ///
+ /// Static class that adds extension methods to . This class cannot be inherited.
+ ///
public static class DefaultHtmlGeneratorExtensions
{
+ ///
+ /// Generates a form.
+ ///
+ /// The .
+ /// The .
+ /// The action name.
+ /// The name of the controller.
+ /// The fragment.
+ /// The route values.
+ /// The form method.
+ /// The html attributes.
+ ///
public static TagBuilder GenerateForm(
this IHtmlGenerator generator,
ViewContext viewContext,
@@ -28,6 +43,17 @@ public static TagBuilder GenerateForm(
return tagBuilder;
}
+ ///
+ /// Generates a form for a route.
+ ///
+ /// The .
+ /// The .
+ /// The nam eof the route.
+ /// The route values.
+ /// The fragment.
+ /// The form method.
+ /// The html attributes.
+ /// The .
public static TagBuilder GenerateRouteForm(
this IHtmlGenerator generator,
ViewContext viewContext,
diff --git a/src/Mvc/Mvc.ViewFeatures/src/DependencyInjection/MvcViewFeaturesMvcCoreBuilderExtensions.cs b/src/Mvc/Mvc.ViewFeatures/src/DependencyInjection/MvcViewFeaturesMvcCoreBuilderExtensions.cs
index 933145e614ed..64605ee8a11e 100644
--- a/src/Mvc/Mvc.ViewFeatures/src/DependencyInjection/MvcViewFeaturesMvcCoreBuilderExtensions.cs
+++ b/src/Mvc/Mvc.ViewFeatures/src/DependencyInjection/MvcViewFeaturesMvcCoreBuilderExtensions.cs
@@ -24,8 +24,16 @@
namespace Microsoft.Extensions.DependencyInjection
{
+ ///
+ /// Static class that adds extension methods to . This class cannot be inherited.
+ ///
public static class MvcViewFeaturesMvcCoreBuilderExtensions
{
+ ///
+ /// Add view related services.
+ ///
+ /// The .
+ /// The .
public static IMvcCoreBuilder AddViews(this IMvcCoreBuilder builder)
{
if (builder == null)
@@ -69,6 +77,12 @@ internal static void AddViewComponentApplicationPartsProviders(ApplicationPartMa
}
}
+ ///
+ /// Add view related services.
+ ///
+ /// The .
+ /// The setup action for .
+ /// The .
public static IMvcCoreBuilder AddViews(
this IMvcCoreBuilder builder,
Action setupAction)
@@ -119,6 +133,12 @@ public static IMvcCoreBuilder AddCookieTempDataProvider(
return builder;
}
+ ///
+ /// Configures .
+ ///
+ /// The .
+ /// The setup action.
+ /// The .
public static IMvcCoreBuilder ConfigureViews(
this IMvcCoreBuilder builder,
Action setupAction)
diff --git a/src/Mvc/Mvc.ViewFeatures/src/Diagnostics/MvcDiagnostics.cs b/src/Mvc/Mvc.ViewFeatures/src/Diagnostics/MvcDiagnostics.cs
index c03414d752fc..11aeb52b43a6 100644
--- a/src/Mvc/Mvc.ViewFeatures/src/Diagnostics/MvcDiagnostics.cs
+++ b/src/Mvc/Mvc.ViewFeatures/src/Diagnostics/MvcDiagnostics.cs
@@ -10,10 +10,22 @@
namespace Microsoft.AspNetCore.Mvc.Diagnostics
{
+ ///
+ /// An that occurs before a ViewComponent.
+ ///
public sealed class BeforeViewComponentEventData : EventData
{
+ ///
+ /// The name of the event.
+ ///
public const string EventName = EventNamespace + "BeforeViewComponent";
+ ///
+ /// Initializes a new instance of .
+ ///
+ /// The .
+ /// The .
+ /// The .
public BeforeViewComponentEventData(ActionDescriptor actionDescriptor, ViewComponentContext viewComponentContext, object viewComponent)
{
ActionDescriptor = actionDescriptor;
@@ -21,12 +33,25 @@ public BeforeViewComponentEventData(ActionDescriptor actionDescriptor, ViewCompo
ViewComponent = viewComponent;
}
+ ///
+ /// The .
+ ///
public ActionDescriptor ActionDescriptor { get; }
+
+ ///
+ /// The .
+ ///
public ViewComponentContext ViewComponentContext { get; }
+
+ ///
+ /// The view component.
+ ///
public object ViewComponent { get; }
+ ///
protected override int Count => 3;
+ ///
protected override KeyValuePair this[int index] => index switch
{
0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor),
@@ -36,10 +61,23 @@ public BeforeViewComponentEventData(ActionDescriptor actionDescriptor, ViewCompo
};
}
+ ///
+ /// An that occurs after a ViewComponent.
+ ///
public sealed class AfterViewComponentEventData : EventData
{
+ ///
+ /// The name of the event.
+ ///
public const string EventName = EventNamespace + "AfterViewComponent";
+ ///
+ /// Initializes a new instance of .
+ ///
+ /// The .
+ /// The .
+ /// The .
+ /// The .
public AfterViewComponentEventData(ActionDescriptor actionDescriptor, ViewComponentContext viewComponentContext, IViewComponentResult viewComponentResult, object viewComponent)
{
ActionDescriptor = actionDescriptor;
@@ -48,13 +86,30 @@ public AfterViewComponentEventData(ActionDescriptor actionDescriptor, ViewCompon
ViewComponent = viewComponent;
}
+ ///
+ /// The .
+ ///
public ActionDescriptor ActionDescriptor { get; }
+
+ ///
+ /// The .
+ ///
public ViewComponentContext ViewComponentContext { get; }
+
+ ///
+ /// The .
+ ///
public IViewComponentResult ViewComponentResult { get; }
+
+ ///
+ /// The view component.
+ ///
public object ViewComponent { get; }
+ ///
protected override int Count => 4;
+ ///
protected override KeyValuePair this[int index] => index switch
{
0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor),
@@ -65,22 +120,47 @@ public AfterViewComponentEventData(ActionDescriptor actionDescriptor, ViewCompon
};
}
+ ///
+ /// An that occurs before a view is executed.
+ ///
public sealed class ViewComponentBeforeViewExecuteEventData : EventData
{
+ ///
+ /// The name of the event.
+ ///
public const string EventName = EventNamespace + "ViewComponentBeforeViewExecute";
+ ///
+ /// Initializes a new instance of .
+ ///
+ /// The .
+ /// The .
+ /// The .
public ViewComponentBeforeViewExecuteEventData(ActionDescriptor actionDescriptor, ViewComponentContext viewComponentContext, IView view)
{
ActionDescriptor = actionDescriptor;
ViewComponentContext = viewComponentContext;
View = view;
}
+ ///
+ /// The .
+ ///
public ActionDescriptor ActionDescriptor { get; }
+
+ ///
+ /// The .
+ ///
public ViewComponentContext ViewComponentContext { get; }
+
+ ///
+ /// The .
+ ///
public IView View { get; }
+ ///
protected override int Count => 3;
+ ///
protected override KeyValuePair this[int index] => index switch
{
0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor),
@@ -90,10 +170,22 @@ public ViewComponentBeforeViewExecuteEventData(ActionDescriptor actionDescriptor
};
}
+ ///
+ /// An that occurs after a view is executed.
+ ///
public sealed class ViewComponentAfterViewExecuteEventData : EventData
{
+ ///
+ /// The name of the event.
+ ///
public const string EventName = EventNamespace + "ViewComponentAfterViewExecute";
+ ///
+ /// Initializes a new instance of .
+ ///
+ /// The .
+ /// The .
+ /// The .
public ViewComponentAfterViewExecuteEventData(ActionDescriptor actionDescriptor, ViewComponentContext viewComponentContext, IView view)
{
ActionDescriptor = actionDescriptor;
@@ -101,12 +193,25 @@ public ViewComponentAfterViewExecuteEventData(ActionDescriptor actionDescriptor,
View = view;
}
+ ///
+ /// The .
+ ///
public ActionDescriptor ActionDescriptor { get; }
+
+ ///
+ /// The .
+ ///
public ViewComponentContext ViewComponentContext { get; }
+
+ ///
+ /// The .
+ ///
public IView View { get; }
+ ///
protected override int Count => 3;
+ ///
protected override KeyValuePair this[int index] => index switch
{
0 => new KeyValuePair(nameof(ActionDescriptor), ActionDescriptor),
@@ -116,21 +221,41 @@ public ViewComponentAfterViewExecuteEventData(ActionDescriptor actionDescriptor,
};
}
+ ///
+ /// An that occurs before a view.
+ ///
public sealed class BeforeViewEventData : EventData
{
+ ///
+ /// The name of the event.
+ ///
public const string EventName = EventNamespace + "BeforeView";
+ ///
+ /// Initializes a new instance of .
+ ///
+ /// The .
+ /// The .
public BeforeViewEventData(IView view, ViewContext viewContext)
{
View = view;
ViewContext = viewContext;
}
+ ///
+ /// The .
+ ///
public IView View { get; }
+
+ ///
+ /// The .
+ ///
public ViewContext ViewContext { get; }
+ ///
protected override int Count => 2;
+ ///
protected override KeyValuePair this[int index] => index switch
{
0 => new KeyValuePair(nameof(View), View),
@@ -139,21 +264,41 @@ public BeforeViewEventData(IView view, ViewContext viewContext)
};
}
+ ///
+ /// An that occurs after a view.
+ ///
public sealed class AfterViewEventData : EventData
{
+ ///
+ /// The name of the event.
+ ///
public const string EventName = EventNamespace + "AfterView";
+ ///
+ /// Initializes a new instance of .
+ ///
+ /// The .
+ /// The .
public AfterViewEventData(IView view, ViewContext viewContext)
{
View = view;
ViewContext = viewContext;
}
+ ///
+ /// The .
+ ///
public IView View { get; }
+
+ ///
+ /// The .
+ ///
public ViewContext ViewContext { get; }
+ ///
protected override int Count => 2;
+ ///
protected override KeyValuePair this[int index] => index switch
{
0 => new KeyValuePair(nameof(View), View),
@@ -162,10 +307,24 @@ public AfterViewEventData(IView view, ViewContext viewContext)
};
}
+ ///
+ /// An that when a view is found.
+ ///
public sealed class ViewFoundEventData : EventData
{
+ ///
+ /// The name of the event.
+ ///
public const string EventName = EventNamespace + "ViewFound";
+ ///
+ /// Initializes a new instance of .
+ ///
+ /// The .
+ /// Whether this is a main page.
+ /// The .
+ /// The name of the view.
+ /// The .
public ViewFoundEventData(ActionContext actionContext, bool isMainPage, ActionResult result, string viewName, IView view)
{
ActionContext = actionContext;
@@ -175,14 +334,35 @@ public ViewFoundEventData(ActionContext actionContext, bool isMainPage, ActionRe
View = view;
}
+ ///
+ /// The .
+ ///
public ActionContext ActionContext { get; }
+
+ ///
+ /// if a main page.
+ ///
public bool IsMainPage { get; }
+
+ ///
+ /// The .
+ ///
public ActionResult Result { get; }
+
+ ///
+ /// The name of the view.
+ ///
public string ViewName { get; }
+
+ ///
+ /// The .
+ ///
public IView View { get; }
+ ///
protected override int Count => 5;
+ ///
protected override KeyValuePair this[int index] => index switch
{
0 => new KeyValuePair(nameof(ActionContext), ActionContext),
@@ -194,10 +374,24 @@ public ViewFoundEventData(ActionContext actionContext, bool isMainPage, ActionRe
};
}
+ ///
+ /// An that when a view is not found.
+ ///
public sealed class ViewNotFoundEventData : EventData
{
+ ///
+ /// The name of the event.
+ ///
public const string EventName = EventNamespace + "ViewNotFound";
+ ///
+ /// Initializes a new instance of .
+ ///
+ /// The .
+ /// Whether this is a main page.
+ /// The .
+ /// The name of the view.
+ /// The locations searched for the view.
public ViewNotFoundEventData(ActionContext actionContext, bool isMainPage, ActionResult result, string viewName, IEnumerable searchedLocations)
{
ActionContext = actionContext;
@@ -207,14 +401,35 @@ public ViewNotFoundEventData(ActionContext actionContext, bool isMainPage, Actio
SearchedLocations = searchedLocations;
}
+ ///
+ /// The .
+ ///
public ActionContext ActionContext { get; }
+
+ ///
+ /// if a main page.
+ ///
public bool IsMainPage { get; }
+
+ ///
+ /// The .
+ ///
public ActionResult Result { get; }
+
+ ///
+ /// The name of the view.
+ ///
public string ViewName { get; }
+
+ ///
+ /// The locations that were searched.
+ ///
public IEnumerable SearchedLocations { get; }
+ ///
protected override int Count => 5;
+ ///
protected override KeyValuePair this[int index] => index switch
{
0 => new KeyValuePair(nameof(ActionContext), ActionContext),
@@ -225,4 +440,4 @@ public ViewNotFoundEventData(ActionContext actionContext, bool isMainPage, Actio
_ => throw new IndexOutOfRangeException(nameof(index))
};
}
-}
\ No newline at end of file
+}
diff --git a/src/Mvc/Mvc.ViewFeatures/src/HtmlHelper.cs b/src/Mvc/Mvc.ViewFeatures/src/HtmlHelper.cs
index cf8ee07fd90b..0f4c03390f20 100644
--- a/src/Mvc/Mvc.ViewFeatures/src/HtmlHelper.cs
+++ b/src/Mvc/Mvc.ViewFeatures/src/HtmlHelper.cs
@@ -22,11 +22,34 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
///
public class HtmlHelper : IHtmlHelper, IViewContextAware
{
+ ///
+ /// CSS class name for input validation.
+ ///
public static readonly string ValidationInputCssClassName = "input-validation-error";
+
+ ///
+ /// CSS class name for valid input validation.
+ ///
public static readonly string ValidationInputValidCssClassName = "input-validation-valid";
+
+ ///
+ /// CSS class name for field validation error.
+ ///
public static readonly string ValidationMessageCssClassName = "field-validation-error";
+
+ ///
+ /// CSS class name for valid field validation.
+ ///
public static readonly string ValidationMessageValidCssClassName = "field-validation-valid";
+
+ ///
+ /// CSS class name for validation summary errors.
+ ///
public static readonly string ValidationSummaryCssClassName = "validation-summary-errors";
+
+ ///
+ /// CSS class name for valid validation summary.
+ ///
public static readonly string ValidationSummaryValidCssClassName = "validation-summary-valid";
private readonly IHtmlGenerator _htmlGenerator;
@@ -178,6 +201,10 @@ public static IDictionary AnonymousObjectToHtmlAttributes(object
return dictionary;
}
+ ///
+ /// Sets the .
+ ///
+ /// The context to use.
public virtual void Contextualize(ViewContext viewContext)
{
if (viewContext == null)
@@ -483,6 +510,14 @@ public Task RenderPartialAsync(string partialViewName, object model, ViewDataDic
return RenderPartialCoreAsync(partialViewName, model, viewData, ViewContext.Writer);
}
+ ///
+ /// Generate a display.
+ ///
+ /// The .
+ /// The name of the html field.
+ /// The name of the template.
+ /// The additional view data.
+ /// .
protected virtual IHtmlContent GenerateDisplay(
ModelExplorer modelExplorer,
string htmlFieldName,
@@ -503,6 +538,14 @@ protected virtual IHtmlContent GenerateDisplay(
return templateBuilder.Build();
}
+ ///
+ /// Render a partial view.
+ ///
+ /// The name of the partial view.
+ /// The model.
+ /// The view data.
+ /// The .
+ /// The .
protected virtual async Task RenderPartialCoreAsync(
string partialViewName,
object model,
@@ -708,6 +751,17 @@ protected virtual MvcForm CreateForm()
return new MvcForm(ViewContext, _htmlEncoder);
}
+ ///
+ /// Generate a check box.
+ ///
+ /// The .
+ /// The expression.
+ /// Whether the box should be checked.
+ ///
+ /// An that contains the HTML attributes for the element. Alternatively, an
+ /// instance containing the HTML attributes.
+ ///
+ ///
protected virtual IHtmlContent GenerateCheckBox(
ModelExplorer modelExplorer,
string expression,
@@ -757,6 +811,12 @@ protected virtual IHtmlContent GenerateCheckBox(
.AppendHtml(hiddenForCheckbox);
}
+ ///
+ /// Generate display name.
+ ///
+ /// The .
+ /// The expression.
+ /// The display name.
protected virtual string GenerateDisplayName(ModelExplorer modelExplorer, string expression)
{
if (modelExplorer == null)
@@ -785,11 +845,28 @@ protected virtual string GenerateDisplayName(ModelExplorer modelExplorer, string
return resolvedDisplayName ?? string.Empty;
}
+ ///
+ /// Generate display text.
+ ///
+ /// The .
+ /// The text.
protected virtual string GenerateDisplayText(ModelExplorer modelExplorer)
{
return modelExplorer.GetSimpleDisplayText() ?? string.Empty;
}
+ ///
+ /// Generate a drop down.
+ ///
+ /// The .
+ /// The expression.
+ /// The select list.
+ /// The option lable.
+ ///
+ /// An that contains the HTML attributes for the element. Alternatively, an
+ /// instance containing the HTML attributes.
+ ///
+ /// The .
protected IHtmlContent GenerateDropDown(
ModelExplorer modelExplorer,
string expression,
@@ -813,6 +890,14 @@ protected IHtmlContent GenerateDropDown(
return tagBuilder;
}
+ ///
+ /// Generate editor.
+ ///
+ /// The .
+ /// The name of the html field.
+ /// The name of the template
+ /// Additional view data.
+ /// The .
protected virtual IHtmlContent GenerateEditor(
ModelExplorer modelExplorer,
string htmlFieldName,
@@ -948,6 +1033,18 @@ protected virtual MvcForm GenerateRouteForm(
return CreateForm();
}
+ ///
+ /// Generate a hidden.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// An that contains the HTML attributes for the element. Alternatively, an
+ /// instance containing the HTML attributes.
+ ///
+ /// The .
protected virtual IHtmlContent GenerateHidden(
ModelExplorer modelExplorer,
string expression,
@@ -970,6 +1067,11 @@ protected virtual IHtmlContent GenerateHidden(
return tagBuilder;
}
+ ///
+ /// Generate an id.
+ ///
+ /// The expresion.
+ /// The id.
protected virtual string GenerateId(string expression)
{
var fullName = NameAndIdProvider.GetFullHtmlFieldName(ViewContext, expression);
@@ -977,6 +1079,17 @@ protected virtual string GenerateId(string expression)
return GenerateIdFromName(fullName);
}
+ ///
+ /// Generate a label.
+ ///
+ /// The .
+ /// The expresion.
+ /// The label text.
+ ///
+ /// An that contains the HTML attributes for the element. Alternatively, an
+ /// instance containing the HTML attributes.
+ ///
+ /// The .
protected virtual IHtmlContent GenerateLabel(
ModelExplorer modelExplorer,
string expression,
@@ -1021,6 +1134,17 @@ protected virtual IHtmlContent GenerateLabel(
return tagBuilder;
}
+ ///
+ /// Generate a list box.
+ ///
+ /// The .
+ /// The expression.
+ /// An enumeration of .
+ ///
+ /// An that contains the HTML attributes for the element. Alternatively, an
+ /// instance containing the HTML attributes.
+ ///
+ /// The .
protected IHtmlContent GenerateListBox(
ModelExplorer modelExplorer,
string expression,
@@ -1043,12 +1167,28 @@ protected IHtmlContent GenerateListBox(
return tagBuilder;
}
+ ///
+ /// Geneate a name.
+ ///
+ /// The expression.
+ /// The name.
protected virtual string GenerateName(string expression)
{
var fullName = NameAndIdProvider.GetFullHtmlFieldName(ViewContext, expression);
return fullName;
}
+ ///
+ /// Generate a password.
+ ///
+ /// The .
+ /// The expression.
+ /// The password value.
+ ///
+ /// An that contains the HTML attributes for the element. Alternatively, an
+ /// instance containing the HTML attributes.
+ ///
+ /// The .
protected virtual IHtmlContent GeneratePassword(
ModelExplorer modelExplorer,
string expression,
@@ -1069,6 +1209,18 @@ protected virtual IHtmlContent GeneratePassword(
return tagBuilder;
}
+ ///
+ /// Generate a radio button.
+ ///
+ /// The .
+ /// The expression.
+ /// The value.
+ /// If the radio button is checked.
+ ///
+ /// An that contains the HTML attributes for the element. Alternatively, an
+ /// instance containing the HTML attributes.
+ ///
+ /// The .
protected virtual IHtmlContent GenerateRadioButton(
ModelExplorer modelExplorer,
string expression,
@@ -1091,6 +1243,18 @@ protected virtual IHtmlContent GenerateRadioButton(
return tagBuilder;
}
+ ///
+ /// Generate a text area.
+ ///
+ /// The .
+ /// The expression.
+ /// The number of rows.
+ /// The number of columns.
+ ///
+ /// An that contains the HTML attributes for the element. Alternatively, an
+ /// instance containing the HTML attributes.
+ ///
+ /// The .
protected virtual IHtmlContent GenerateTextArea(
ModelExplorer modelExplorer,
string expression,
@@ -1113,6 +1277,18 @@ protected virtual IHtmlContent GenerateTextArea(
return tagBuilder;
}
+ ///
+ /// Generates a text box.
+ ///
+ /// The .
+ /// The expression.
+ /// The value.
+ /// The format.
+ ///
+ /// An that contains the HTML attributes for the element. Alternatively, an
+ /// instance containing the HTML attributes.
+ ///
+ /// The .
protected virtual IHtmlContent GenerateTextBox(
ModelExplorer modelExplorer,
string expression,
@@ -1135,6 +1311,18 @@ protected virtual IHtmlContent GenerateTextBox(
return tagBuilder;
}
+ ///
+ /// Generate a validation message.
+ ///
+ /// The .
+ /// The expression.
+ /// The validation message.
+ /// The tag.
+ ///
+ /// An that contains the HTML attributes for the element. Alternatively, an
+ /// instance containing the HTML attributes.
+ ///
+ /// The .
protected virtual IHtmlContent GenerateValidationMessage(
ModelExplorer modelExplorer,
string expression,
@@ -1157,6 +1345,17 @@ protected virtual IHtmlContent GenerateValidationMessage(
return tagBuilder;
}
+ ///
+ /// Generate a validation summary.
+ ///
+ /// Whether to exclude property errors.
+ /// The validation message.
+ ///
+ /// An that contains the HTML attributes for the element. Alternatively, an
+ /// instance containing the HTML attributes.
+ ///
+ /// The tag.
+ /// The .
protected virtual IHtmlContent GenerateValidationSummary(
bool excludePropertyErrors,
string message,
@@ -1177,6 +1376,14 @@ protected virtual IHtmlContent GenerateValidationSummary(
return tagBuilder;
}
+ ///
+ /// Generate a value.
+ ///
+ /// The expression.
+ /// The value.
+ /// The format.
+ /// Whether to use view data.
+ /// The value.
protected virtual string GenerateValue(string expression, object value, string format, bool useViewData)
{
var fullName = NameAndIdProvider.GetFullHtmlFieldName(ViewContext, expression);
diff --git a/src/Mvc/Mvc.ViewFeatures/src/HtmlHelperOfT.cs b/src/Mvc/Mvc.ViewFeatures/src/HtmlHelperOfT.cs
index 9dda5426aa61..07c030bb2a51 100644
--- a/src/Mvc/Mvc.ViewFeatures/src/HtmlHelperOfT.cs
+++ b/src/Mvc/Mvc.ViewFeatures/src/HtmlHelperOfT.cs
@@ -13,6 +13,10 @@
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
+ ///
+ /// A for a specific model type.
+ ///
+ /// The model type.
public class HtmlHelper : HtmlHelper, IHtmlHelper
{
private readonly ModelExpressionProvider _modelExpressionProvider;
@@ -42,6 +46,7 @@ public HtmlHelper(
///
public new ViewDataDictionary ViewData { get; private set; }
+ ///
public override void Contextualize(ViewContext viewContext)
{
if (viewContext == null)
diff --git a/src/Mvc/Mvc.ViewFeatures/src/IHtmlGenerator.cs b/src/Mvc/Mvc.ViewFeatures/src/IHtmlGenerator.cs
index fb6859087d99..1993a97ee3fc 100644
--- a/src/Mvc/Mvc.ViewFeatures/src/IHtmlGenerator.cs
+++ b/src/Mvc/Mvc.ViewFeatures/src/IHtmlGenerator.cs
@@ -12,12 +12,31 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
///
public interface IHtmlGenerator
{
+ ///
+ /// Gets the replacement for '.' in an Id attribute.
+ ///
string IdAttributeDotReplacement { get; }
+ ///
+ /// Encodes a value.
+ ///
+ /// The value to encode.
+ /// The encoded value.
string Encode(string value);
+ ///
+ /// Encodes a value.
+ ///
+ /// The value to encode.
+ /// The encoded value.
string Encode(object value);
+ ///
+ /// Format a value.
+ ///
+ /// The value to format.
+ /// The format to use.
+ /// The formatted value.
string FormatValue(object value, string format);
///
diff --git a/src/Mvc/Mvc.ViewFeatures/src/InputType.cs b/src/Mvc/Mvc.ViewFeatures/src/InputType.cs
index 03ebd45b6b7f..7709d70ebc2c 100644
--- a/src/Mvc/Mvc.ViewFeatures/src/InputType.cs
+++ b/src/Mvc/Mvc.ViewFeatures/src/InputType.cs
@@ -3,12 +3,34 @@
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
+ ///
+ /// Specifies constants which define an input type.
+ ///
public enum InputType
{
+ ///
+ /// A check box input.
+ ///
CheckBox,
+
+ ///
+ /// A hidden input.
+ ///
Hidden,
+
+ ///
+ /// A password input.
+ ///
Password,
+
+ ///
+ /// A radio input.
+ ///
Radio,
+
+ ///
+ /// A text input.
+ ///
Text
}
}
diff --git a/src/Mvc/Mvc.ViewFeatures/src/Microsoft.AspNetCore.Mvc.ViewFeatures.csproj b/src/Mvc/Mvc.ViewFeatures/src/Microsoft.AspNetCore.Mvc.ViewFeatures.csproj
index 0a93600bcf97..3582ce61c562 100644
--- a/src/Mvc/Mvc.ViewFeatures/src/Microsoft.AspNetCore.Mvc.ViewFeatures.csproj
+++ b/src/Mvc/Mvc.ViewFeatures/src/Microsoft.AspNetCore.Mvc.ViewFeatures.csproj
@@ -9,7 +9,7 @@
Microsoft.AspNetCore.Mvc.ViewComponent
$(DefaultNetCoreTargetFramework)
- $(NoWarn);CS1591
+ $(NoWarn.Replace('1591', ''))
true
true
aspnetcore;aspnetcoremvc
diff --git a/src/Mvc/Mvc.ViewFeatures/src/RemoteAttributeBase.cs b/src/Mvc/Mvc.ViewFeatures/src/RemoteAttributeBase.cs
index ef0a756acd3c..b935c0f6f1b3 100644
--- a/src/Mvc/Mvc.ViewFeatures/src/RemoteAttributeBase.cs
+++ b/src/Mvc/Mvc.ViewFeatures/src/RemoteAttributeBase.cs
@@ -1,4 +1,4 @@
-// Copyright (c) .NET Foundation. All rights reserved.
+// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
@@ -29,7 +29,10 @@ public abstract class RemoteAttributeBase : ValidationAttribute, IClientModelVal
private string[] _additionalFieldsSplit = Array.Empty();
private bool _checkedForLocalizer;
private IStringLocalizer _stringLocalizer;
-
+
+ ///
+ /// Initialize a new instance of .
+ ///
protected RemoteAttributeBase()
: base(errorMessageAccessor: () => Resources.RemoteAttribute_RemoteValidationFailed)
{
diff --git a/src/Mvc/Mvc.ViewFeatures/src/Rendering/FormMethod.cs b/src/Mvc/Mvc.ViewFeatures/src/Rendering/FormMethod.cs
index b765d4877bc8..a1822d6fad7b 100644
--- a/src/Mvc/Mvc.ViewFeatures/src/Rendering/FormMethod.cs
+++ b/src/Mvc/Mvc.ViewFeatures/src/Rendering/FormMethod.cs
@@ -3,9 +3,19 @@
namespace Microsoft.AspNetCore.Mvc.Rendering
{
+ ///
+ /// Specifies constants which define the form method used.
+ ///
public enum FormMethod
{
+ ///
+ /// Get form method.
+ ///
Get,
+
+ ///
+ /// Post form method.
+ ///
Post
}
}
diff --git a/src/Mvc/Mvc.ViewFeatures/src/Rendering/MultiSelectList.cs b/src/Mvc/Mvc.ViewFeatures/src/Rendering/MultiSelectList.cs
index f9205363a202..a10ea3c41e70 100644
--- a/src/Mvc/Mvc.ViewFeatures/src/Rendering/MultiSelectList.cs
+++ b/src/Mvc/Mvc.ViewFeatures/src/Rendering/MultiSelectList.cs
@@ -20,6 +20,10 @@ public class MultiSelectList : IEnumerable
private readonly IList _groups;
private IList _selectListItems;
+ ///
+ /// Initialize a new instance of .
+ ///
+ /// The items.
public MultiSelectList(IEnumerable items)
: this(items, selectedValues: null)
{
@@ -29,6 +33,11 @@ public MultiSelectList(IEnumerable items)
}
}
+ ///
+ /// Initialize a new instance of .
+ ///
+ /// The items.
+ /// The selected values.
public MultiSelectList(IEnumerable items, IEnumerable selectedValues)
: this(items, dataValueField: null, dataTextField: null, selectedValues: selectedValues)
{
@@ -38,6 +47,12 @@ public MultiSelectList(IEnumerable items, IEnumerable selectedValues)
}
}
+ ///
+ /// Initialize a new instance of .
+ ///
+ /// The items.
+ /// The data value field.
+ /// The data text field.
public MultiSelectList(IEnumerable items, string dataValueField, string dataTextField)
: this(items, dataValueField, dataTextField, selectedValues: null)
{
@@ -47,6 +62,13 @@ public MultiSelectList(IEnumerable items, string dataValueField, string dataText
}
}
+ ///
+ /// Initialize a new instance of .
+ ///
+ /// The items.
+ /// The data value field.
+ /// The data text field.
+ /// The selected values.
public MultiSelectList(
IEnumerable items,
string dataValueField,
@@ -98,18 +120,31 @@ public MultiSelectList(
}
///
- /// Gets or sets the data group field.
+ /// Gets the data group field.
///
public string DataGroupField { get; }
+ ///
+ /// Gets the data text field.
+ ///
public string DataTextField { get; }
+ ///
+ /// Gets the data value field.
+ ///
public string DataValueField { get; }
+ ///
+ /// Gets the items.
+ ///
public IEnumerable Items { get; }
+ ///
+ /// Gets the selected values.
+ ///
public IEnumerable SelectedValues { get; }
+ ///
public virtual IEnumerator GetEnumerator()
{
if (_selectListItems == null)
diff --git a/src/Mvc/Mvc.ViewFeatures/src/Rendering/SelectList.cs b/src/Mvc/Mvc.ViewFeatures/src/Rendering/SelectList.cs
index 69649326c826..4d1f441028df 100644
--- a/src/Mvc/Mvc.ViewFeatures/src/Rendering/SelectList.cs
+++ b/src/Mvc/Mvc.ViewFeatures/src/Rendering/SelectList.cs
@@ -13,6 +13,10 @@ namespace Microsoft.AspNetCore.Mvc.Rendering
///
public class SelectList : MultiSelectList
{
+ ///
+ /// Initialize a new instance of .
+ ///
+ /// The items.
public SelectList(IEnumerable items)
: this(items, selectedValue: null)
{
@@ -22,6 +26,11 @@ public SelectList(IEnumerable items)
}
}
+ ///
+ /// Initialize a new instance of .
+ ///
+ /// The items.
+ /// The selected value.
public SelectList(IEnumerable items, object selectedValue)
: this(items, dataValueField: null, dataTextField: null, selectedValue: selectedValue)
{
@@ -31,6 +40,12 @@ public SelectList(IEnumerable items, object selectedValue)
}
}
+ ///
+ /// Initialize a new instance of .
+ ///
+ /// The items.
+ /// The data value field.
+ /// The data text field.
public SelectList(IEnumerable items, string dataValueField, string dataTextField)
: this(items, dataValueField, dataTextField, selectedValue: null)
{
@@ -40,6 +55,13 @@ public SelectList(IEnumerable items, string dataValueField, string dataTextField
}
}
+ ///
+ /// Initialize a new instance of .
+ ///
+ /// The items.
+ /// The data value field.
+ /// The data text field.
+ /// The selected value.
public SelectList(
IEnumerable items,
string dataValueField,
@@ -84,6 +106,9 @@ public SelectList(
SelectedValue = selectedValue;
}
+ ///
+ /// The selected value.
+ ///
public object SelectedValue { get; }
private static IEnumerable ToEnumerable(object selectedValue)
diff --git a/src/Mvc/Mvc.ViewFeatures/src/Rendering/TagBuilder.cs b/src/Mvc/Mvc.ViewFeatures/src/Rendering/TagBuilder.cs
index 4b6d8b6fcb56..bfec077a4d13 100644
--- a/src/Mvc/Mvc.ViewFeatures/src/Rendering/TagBuilder.cs
+++ b/src/Mvc/Mvc.ViewFeatures/src/Rendering/TagBuilder.cs
@@ -276,11 +276,22 @@ private void AppendAttributes(TextWriter writer, HtmlEncoder encoder)
}
}
+ ///
+ /// Merge an attribute.
+ ///
+ /// The attribute key.
+ /// The attribute value.
public void MergeAttribute(string key, string value)
{
MergeAttribute(key, value, replaceExisting: false);
}
+ ///
+ /// Merge an attribute.
+ ///
+ /// The attribute key.
+ /// The attribute value.
+ /// Whether to replace an existing value.
public void MergeAttribute(string key, string value, bool replaceExisting)
{
if (string.IsNullOrEmpty(key))
@@ -294,11 +305,24 @@ public void MergeAttribute(string key, string value, bool replaceExisting)
}
}
+ ///
+ /// Merge an attribute dictionary.
+ ///
+ /// The key type.
+ /// The value type.
+ /// The attributes.
public void MergeAttributes(IDictionary attributes)
{
MergeAttributes(attributes, replaceExisting: false);
}
+ ///
+ /// Merge an attribute dictionary.
+ ///
+ /// The key type.
+ /// The value type.
+ /// The attributes.
+ /// Whether to replace existing attributes.
public void MergeAttributes(IDictionary attributes, bool replaceExisting)
{
// Perf: Avoid allocating enumerator for `attributes` if possible
diff --git a/src/Mvc/Mvc.ViewFeatures/src/Rendering/TagRenderMode.cs b/src/Mvc/Mvc.ViewFeatures/src/Rendering/TagRenderMode.cs
index c9d89b2c72c8..f6eaa5107390 100644
--- a/src/Mvc/Mvc.ViewFeatures/src/Rendering/TagRenderMode.cs
+++ b/src/Mvc/Mvc.ViewFeatures/src/Rendering/TagRenderMode.cs
@@ -3,11 +3,29 @@
namespace Microsoft.AspNetCore.Mvc.Rendering
{
+ ///
+ /// Specifies constants for tag rendering modes.
+ ///
public enum TagRenderMode
{
+ ///
+ /// Normal mode.
+ ///
Normal,
+
+ ///
+ /// Start tag mode.
+ ///
StartTag,
+
+ ///
+ /// End tag mode.
+ ///
EndTag,
+
+ ///
+ /// Self closing mode.
+ ///
SelfClosing
}
}
diff --git a/src/Mvc/Mvc.ViewFeatures/src/Rendering/ViewContext.cs b/src/Mvc/Mvc.ViewFeatures/src/Rendering/ViewContext.cs
index ac2d6c48c984..4f13f3b5b412 100644
--- a/src/Mvc/Mvc.ViewFeatures/src/Rendering/ViewContext.cs
+++ b/src/Mvc/Mvc.ViewFeatures/src/Rendering/ViewContext.cs
@@ -242,6 +242,10 @@ public dynamic ViewBag
///
internal Dictionary