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 Items => _items ??= new Dictionary(); + /// + /// Gets the if is enabled. + /// + /// public FormContext GetFormContextForClientValidation() { return ClientValidationEnabled ? FormContext : null; diff --git a/src/Mvc/Mvc.ViewFeatures/src/SaveTempDataAttribute.cs b/src/Mvc/Mvc.ViewFeatures/src/SaveTempDataAttribute.cs index a42be3520266..6736d17b1374 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/SaveTempDataAttribute.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/SaveTempDataAttribute.cs @@ -14,6 +14,9 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] public class SaveTempDataAttribute : Attribute, IFilterFactory, IOrderedFilter { + /// + /// Initialize a new instance of . + /// public SaveTempDataAttribute() { // Since SaveTempDataFilter registers for a response's OnStarting callback, we want this filter to run diff --git a/src/Mvc/Mvc.ViewFeatures/src/SessionStateTempDataProvider.cs b/src/Mvc/Mvc.ViewFeatures/src/SessionStateTempDataProvider.cs index 0aa5cf3e4004..f6835673d591 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/SessionStateTempDataProvider.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/SessionStateTempDataProvider.cs @@ -17,6 +17,10 @@ public class SessionStateTempDataProvider : ITempDataProvider internal const string TempDataSessionStateKey = "__ControllerTempData"; private readonly TempDataSerializer _tempDataSerializer; + /// + /// Initializes a new instance of . + /// + /// The . public SessionStateTempDataProvider(TempDataSerializer tempDataSerializer) { _tempDataSerializer = tempDataSerializer; @@ -67,4 +71,4 @@ public virtual void SaveTempData(HttpContext context, IDictionary public int Count { get @@ -51,6 +52,7 @@ public int Count } } + /// public ICollection Keys { get @@ -60,6 +62,7 @@ public ICollection Keys } } + /// public ICollection Values { get @@ -69,6 +72,7 @@ public ICollection Values } } + /// bool ICollection>.IsReadOnly { get @@ -78,6 +82,7 @@ bool ICollection>.IsReadOnly } } + /// public object this[string key] { get @@ -168,6 +173,7 @@ public object Peek(string key) return value; } + /// public void Add(string key, object value) { Load(); @@ -175,6 +181,7 @@ public void Add(string key, object value) _initialKeys.Add(key); } + /// public void Clear() { Load(); @@ -183,24 +190,28 @@ public void Clear() _initialKeys.Clear(); } + /// public bool ContainsKey(string key) { Load(); return _data.ContainsKey(key); } + /// public bool ContainsValue(object value) { Load(); return _data.ContainsValue(value); } + /// public IEnumerator> GetEnumerator() { Load(); return new TempDataDictionaryEnumerator(this); } + /// public bool Remove(string key) { Load(); @@ -209,6 +220,7 @@ public bool Remove(string key) return _data.Remove(key); } + /// public bool TryGetValue(string key, out object value) { Load(); @@ -289,4 +301,4 @@ void IDisposable.Dispose() } } } -} \ No newline at end of file +} diff --git a/src/Mvc/Mvc.ViewFeatures/src/TemplateInfo.cs b/src/Mvc/Mvc.ViewFeatures/src/TemplateInfo.cs index 169494382172..43a9b9e33366 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/TemplateInfo.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/TemplateInfo.cs @@ -6,6 +6,9 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures { + /// + /// Represents a template which keeps track of visited objects. + /// public class TemplateInfo { // Keep a collection of visited objects to prevent infinite recursion. @@ -14,6 +17,9 @@ public class TemplateInfo private object _formattedModelValue; private string _htmlFieldPrefix; + /// + /// Initializes a new instance of . + /// public TemplateInfo() { _htmlFieldPrefix = string.Empty; @@ -21,6 +27,10 @@ public TemplateInfo() _visitedObjects = new HashSet(); } + /// + /// Initializes a new instance of . + /// + /// The original value to copy. public TemplateInfo(TemplateInfo original) { FormattedModelValue = original.FormattedModelValue; @@ -55,11 +65,19 @@ public string HtmlFieldPrefix set { _htmlFieldPrefix = value ?? string.Empty; } } + /// + /// Gets how many objects have been visited. + /// public int TemplateDepth { get { return _visitedObjects.Count; } } + /// + /// Mark a value as visited. + /// + /// The object to visit. + /// If this object is newly visited. public bool AddVisited(object value) { return _visitedObjects.Add(value); @@ -92,6 +110,11 @@ public string GetFullHtmlFieldName(string partialFieldName) return HtmlFieldPrefix + "." + partialFieldName; } + /// + /// Checks if a model has been visited already. + /// + /// The . + /// Whether the model has been visited. public bool Visited(ModelExplorer modelExplorer) { return _visitedObjects.Contains(modelExplorer.Model ?? modelExplorer.Metadata.ModelType); diff --git a/src/Mvc/Mvc.ViewFeatures/src/TryGetValueDelegate.cs b/src/Mvc/Mvc.ViewFeatures/src/TryGetValueDelegate.cs index 44b2e4e3dd3b..a9be5af28492 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/TryGetValueDelegate.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/TryGetValueDelegate.cs @@ -3,5 +3,12 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures { + /// + /// A delegate for . + /// + /// The . + /// The key. + /// The return value. + /// Whether the key was found. public delegate bool TryGetValueDelegate(object dictionary, string key, out object value); } diff --git a/src/Mvc/Mvc.ViewFeatures/src/TryGetValueProvider.cs b/src/Mvc/Mvc.ViewFeatures/src/TryGetValueProvider.cs index a121363f4fe4..939757ef9368 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/TryGetValueProvider.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/TryGetValueProvider.cs @@ -10,6 +10,9 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures { + /// + /// Static class that provides caching for TryGetValue. This class cannot be inherited. + /// public static class TryGetValueProvider { private static readonly Dictionary _tryGetValueDelegateCache = @@ -20,6 +23,11 @@ public static class TryGetValueProvider private static readonly MethodInfo _strongTryGetValueImplInfo = typeof(TryGetValueProvider).GetTypeInfo().GetDeclaredMethod(nameof(StrongTryGetValueImpl)); + /// + /// Returns a for the specified type. + /// + /// The target type that is expected to be a . + /// The . public static TryGetValueDelegate CreateInstance(Type targetType) { if (targetType == null) @@ -98,4 +106,4 @@ private static bool TryGetValueFromNonGenericDictionary(object dictionary, strin return success; } } -} \ No newline at end of file +} diff --git a/src/Mvc/Mvc.ViewFeatures/src/ViewComponent.cs b/src/Mvc/Mvc.ViewFeatures/src/ViewComponent.cs index 125fdc86acbd..df9d17e5b972 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/ViewComponent.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/ViewComponent.cs @@ -101,6 +101,9 @@ public IUrlHelper Url } } + /// + /// Gets or sets the . + /// [ViewComponentContext] public ViewComponentContext ViewComponentContext { diff --git a/src/Mvc/Mvc.ViewFeatures/src/ViewComponentResultExecutor.cs b/src/Mvc/Mvc.ViewFeatures/src/ViewComponentResultExecutor.cs index 7f4cd97d5d20..2a74e51d4539 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/ViewComponentResultExecutor.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/ViewComponentResultExecutor.cs @@ -19,6 +19,9 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures { + /// + /// A for . + /// public class ViewComponentResultExecutor : IActionResultExecutor { private readonly HtmlEncoder _htmlEncoder; @@ -28,6 +31,9 @@ public class ViewComponentResultExecutor : IActionResultExecutor + /// This constructor is obsolete and will be removed in a future version. + /// [Obsolete("This constructor is obsolete and will be removed in a future version.")] public ViewComponentResultExecutor( IOptions mvcHelperOptions, @@ -39,6 +45,15 @@ public ViewComponentResultExecutor( { } + /// + /// Initialize a new instance of + /// + /// The . + /// The . + /// The . + /// The . + /// The . + /// The . public ViewComponentResultExecutor( IOptions mvcHelperOptions, ILoggerFactory loggerFactory, diff --git a/src/Mvc/Mvc.ViewFeatures/src/ViewComponents/IViewComponentInvokerFactory.cs b/src/Mvc/Mvc.ViewFeatures/src/ViewComponents/IViewComponentInvokerFactory.cs index 5269162086da..077fe5d65891 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/ViewComponents/IViewComponentInvokerFactory.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/ViewComponents/IViewComponentInvokerFactory.cs @@ -3,8 +3,16 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents { + /// + /// Interface that exposts the ability to create an . + /// public interface IViewComponentInvokerFactory { + /// + /// Creates a . + /// + /// The . + /// The . IViewComponentInvoker CreateInstance(ViewComponentContext context); } } diff --git a/src/Mvc/Mvc.ViewFeatures/src/ViewComponents/ViewComponentConventions.cs b/src/Mvc/Mvc.ViewFeatures/src/ViewComponents/ViewComponentConventions.cs index 7f0e501c6be6..b50f80a56eb1 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/ViewComponents/ViewComponentConventions.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/ViewComponents/ViewComponentConventions.cs @@ -6,10 +6,21 @@ namespace Microsoft.AspNetCore.Mvc.ViewComponents { + /// + /// Static class that adds standard view component convention methods. This class cannot be inherited. + /// public static class ViewComponentConventions { + /// + /// The suffix for a view component name. + /// public static readonly string ViewComponentSuffix = "ViewComponent"; + /// + /// Gets the name of a component. + /// + /// + /// public static string GetComponentName(TypeInfo componentType) { if (componentType == null) @@ -34,6 +45,12 @@ public static string GetComponentName(TypeInfo componentType) return GetShortNameByConvention(componentType); } + /// + /// Get the component's full name from a type from the first. + /// If not defined, the full name is the Namespace with the . + /// + /// The component type. + /// The full name of the component. public static string GetComponentFullName(TypeInfo componentType) { if (componentType == null) @@ -72,6 +89,13 @@ private static string GetShortNameByConvention(TypeInfo componentType) } } + /// + /// Returns if the type is a public, non abstract, non generic class which + /// defines , but not the + /// and has a name that ends in ViewComponent. + /// + /// The to inspect. + /// If the type is a component. public static bool IsComponent(TypeInfo typeInfo) { if (typeInfo == null) diff --git a/src/Mvc/Mvc.ViewFeatures/src/ViewDataDictionary.cs b/src/Mvc/Mvc.ViewFeatures/src/ViewDataDictionary.cs index c560b810db19..d67e24ac48f5 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/ViewDataDictionary.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/ViewDataDictionary.cs @@ -11,6 +11,9 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures { + /// + /// A for view data. + /// public class ViewDataDictionary : IDictionary { private readonly IDictionary _data; diff --git a/src/Mvc/Mvc.ViewFeatures/src/ViewDataDictionaryControllerPropertyActivator.cs b/src/Mvc/Mvc.ViewFeatures/src/ViewDataDictionaryControllerPropertyActivator.cs index c3c34d4cfc0f..b206303cdcc3 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/ViewDataDictionaryControllerPropertyActivator.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/ViewDataDictionaryControllerPropertyActivator.cs @@ -10,6 +10,9 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures { + /// + /// Represents a for a view data dictionary controller. + /// public class ViewDataDictionaryControllerPropertyActivator : IControllerPropertyActivator { private readonly Func[]> _getPropertiesToActivate; @@ -18,12 +21,17 @@ public class ViewDataDictionaryControllerPropertyActivator : IControllerProperty private bool _initialized; private object _initializeLock = new object(); + /// + /// Initializes a new instance of . + /// + /// The to use. public ViewDataDictionaryControllerPropertyActivator(IModelMetadataProvider modelMetadataProvider) { _modelMetadataProvider = modelMetadataProvider; _getPropertiesToActivate = GetPropertiesToActivate; } + /// public void Activate(ControllerContext actionContext, object controller) { LazyInitializer.EnsureInitialized( @@ -43,6 +51,7 @@ public void Activate(ControllerContext actionContext, object controller) } } + /// public Action GetActivatorDelegate(ControllerActionDescriptor actionDescriptor) { var controllerType = actionDescriptor.ControllerTypeInfo?.AsType(); diff --git a/src/Mvc/Mvc.ViewFeatures/src/ViewDataDictionaryOfT.cs b/src/Mvc/Mvc.ViewFeatures/src/ViewDataDictionaryOfT.cs index 5cd4f4391b22..54a51f04cbb3 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/ViewDataDictionaryOfT.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/ViewDataDictionaryOfT.cs @@ -5,6 +5,10 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures { + /// + /// Represents a for a specific model type. + /// + /// The type of the model. public class ViewDataDictionary : ViewDataDictionary { /// diff --git a/src/Mvc/Mvc.ViewFeatures/src/ViewDataEvaluator.cs b/src/Mvc/Mvc.ViewFeatures/src/ViewDataEvaluator.cs index e0846cc5ff6a..ce4501f5a162 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/ViewDataEvaluator.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/ViewDataEvaluator.cs @@ -8,6 +8,9 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures { + /// + /// Static class that helps evaluate expressions. This class cannot be inherited. + /// public static class ViewDataEvaluator { /// @@ -208,4 +211,4 @@ private static ViewDataInfo GetPropertyValue(object container, string propertyNa return new ViewDataInfo(container, propertyInfo); } } -} \ No newline at end of file +} diff --git a/src/Mvc/Mvc.ViewFeatures/src/ViewDataInfo.cs b/src/Mvc/Mvc.ViewFeatures/src/ViewDataInfo.cs index f9ce77ed3bf9..69e3155c3ec3 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/ViewDataInfo.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/ViewDataInfo.cs @@ -6,6 +6,9 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures { + /// + /// Represents info about a lookup which is evaluated when is read. + /// public class ViewDataInfo { private static readonly Func _propertyInfoResolver = () => null; @@ -53,10 +56,19 @@ public ViewDataInfo(object container, PropertyInfo propertyInfo, Func va _valueAccessor = valueAccessor; } + /// + /// Gets the that has the . + /// public object Container { get; } + /// + /// Gets the that represents 's property. + /// public PropertyInfo PropertyInfo { get; } + /// + /// Gets the value of the property. + /// public object Value { get diff --git a/src/Mvc/Mvc.ViewFeatures/src/ViewEngines/ViewEngineResult.cs b/src/Mvc/Mvc.ViewFeatures/src/ViewEngines/ViewEngineResult.cs index 6fb58cc334be..472f5220cc75 100644 --- a/src/Mvc/Mvc.ViewFeatures/src/ViewEngines/ViewEngineResult.cs +++ b/src/Mvc/Mvc.ViewFeatures/src/ViewEngines/ViewEngineResult.cs @@ -8,20 +8,41 @@ namespace Microsoft.AspNetCore.Mvc.ViewEngines { + /// + /// Represents the result of a view engine. + /// public class ViewEngineResult { private ViewEngineResult() { } + /// + /// The list of locations searched. + /// public IEnumerable SearchedLocations { get; private set; } + /// + /// The . + /// public IView View { get; private set; } + /// + /// Gets or sets the name of the view. + /// public string ViewName { get; private set; } + /// + /// Whether the result was successful + /// public bool Success => View != null; + /// + /// Returns a result that represents when a view is not found. + /// + /// The name of the view. + /// The locations searched. + /// The not found result. public static ViewEngineResult NotFound( string viewName, IEnumerable searchedLocations) @@ -43,6 +64,12 @@ public static ViewEngineResult NotFound( }; } + /// + /// Returns a result when a view is found. + /// + /// The name of the view. + /// The . + /// The found result. public static ViewEngineResult Found(string viewName, IView view) { if (viewName == null) diff --git a/src/Mvc/Mvc/src/Microsoft.AspNetCore.Mvc.csproj b/src/Mvc/Mvc/src/Microsoft.AspNetCore.Mvc.csproj index fbc44beae3c5..4efceaba48bb 100644 --- a/src/Mvc/Mvc/src/Microsoft.AspNetCore.Mvc.csproj +++ b/src/Mvc/Mvc/src/Microsoft.AspNetCore.Mvc.csproj @@ -1,4 +1,4 @@ - + ASP.NET Core MVC is a web framework that gives you a powerful, patterns-based way to build dynamic websites and web APIs. ASP.NET Core MVC enables a clean separation of concerns and gives you full control over markup. @@ -7,6 +7,7 @@ aspnetcore;aspnetcoremvc true false + $(NoWarn.Replace('1591', ''))