diff --git a/src/Microsoft.AspNet.Mvc.Abstractions/IActionResult.cs b/src/Microsoft.AspNet.Mvc.Abstractions/IActionResult.cs
index e2fc5dfc27..224af2199d 100644
--- a/src/Microsoft.AspNet.Mvc.Abstractions/IActionResult.cs
+++ b/src/Microsoft.AspNet.Mvc.Abstractions/IActionResult.cs
@@ -5,8 +5,18 @@ using System.Threading.Tasks;
namespace Microsoft.AspNet.Mvc
{
+ ///
+ /// Defines a contract that represents the result of an action method.
+ ///
public interface IActionResult
{
+ ///
+ /// Executes the result operation of the action method asynchronously. This method is called by MVC to process
+ /// the result of an action method.
+ ///
+ /// The context in which the result is executed. The context information includes
+ /// information about the action that was executed and request information.
+ /// A task that represents the asynchronous execute operation.
Task ExecuteResultAsync(ActionContext context);
}
}
diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResult.cs b/src/Microsoft.AspNet.Mvc.Core/ActionResult.cs
index b135421a79..9627d6be3b 100644
--- a/src/Microsoft.AspNet.Mvc.Core/ActionResult.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/ActionResult.cs
@@ -5,14 +5,32 @@ using System.Threading.Tasks;
namespace Microsoft.AspNet.Mvc
{
+ ///
+ /// A default implementation of .
+ ///
public abstract class ActionResult : IActionResult
{
+ ///
+ /// Executes the result operation of the action method asynchronously. This method is called by MVC to process
+ /// the result of an action method.
+ /// The default implementation of this method calls the method and
+ /// returns a completed task.
+ ///
+ /// The context in which the result is executed. The context information includes
+ /// information about the action that was executed and request information.
+ /// A task that represents the asynchronous execute operation.
public virtual Task ExecuteResultAsync(ActionContext context)
{
ExecuteResult(context);
return Task.FromResult(true);
}
+ ///
+ /// Executes the result operation of the action method synchronously. This method is called by MVC to process
+ /// the result of an action method.
+ ///
+ /// The context in which the result is executed. The context information includes
+ /// information about the action that was executed and request information.
public virtual void ExecuteResult(ActionContext context)
{
}
diff --git a/src/Microsoft.AspNet.Mvc.Core/Builder/MvcApplicationBuilderExtensions.cs b/src/Microsoft.AspNet.Mvc.Core/Builder/MvcApplicationBuilderExtensions.cs
index d23db75a3b..452fbb7402 100644
--- a/src/Microsoft.AspNet.Mvc.Core/Builder/MvcApplicationBuilderExtensions.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/Builder/MvcApplicationBuilderExtensions.cs
@@ -18,7 +18,7 @@ namespace Microsoft.AspNet.Builder
/// Adds MVC to the request execution pipeline.
///
/// The .
- /// The .
+ /// A reference to this instance after the operation has completed.
/// This method only supports attribute routing. To add conventional routes use
/// .
public static IApplicationBuilder UseMvc(this IApplicationBuilder app)
@@ -39,7 +39,7 @@ namespace Microsoft.AspNet.Builder
/// '{controller=Home}/{action=Index}/{id?}'.
///
/// The .
- /// The .
+ /// A reference to this instance after the operation has completed.
public static IApplicationBuilder UseMvcWithDefaultRoute(this IApplicationBuilder app)
{
if (app == null)
@@ -60,7 +60,7 @@ namespace Microsoft.AspNet.Builder
///
/// The .
/// A callback to configure MVC routes.
- /// The .
+ /// A reference to this instance after the operation has completed.
public static IApplicationBuilder UseMvc(
this IApplicationBuilder app,
Action configureRoutes)
diff --git a/src/Microsoft.AspNet.Mvc.Razor/RazorPage.cs b/src/Microsoft.AspNet.Mvc.Razor/RazorPage.cs
index 331054828a..3ac198863a 100644
--- a/src/Microsoft.AspNet.Mvc.Razor/RazorPage.cs
+++ b/src/Microsoft.AspNet.Mvc.Razor/RazorPage.cs
@@ -46,6 +46,9 @@ namespace Microsoft.AspNet.Mvc.Razor
_writerScopes = new Stack();
}
+ ///
+ /// An representing the current request execution.
+ ///
public HttpContext Context
{
get
@@ -81,7 +84,7 @@ namespace Microsoft.AspNet.Mvc.Razor
public IPageExecutionContext PageExecutionContext { get; set; }
///
- /// Gets the TextWriter that the page is writing output to.
+ /// Gets the that the page is writing output to.
///
public virtual TextWriter Output
{
@@ -97,6 +100,9 @@ namespace Microsoft.AspNet.Mvc.Razor
}
}
+ ///
+ /// Gets the of the current logged in user.
+ ///
public virtual ClaimsPrincipal User
{
get
@@ -110,6 +116,9 @@ namespace Microsoft.AspNet.Mvc.Razor
}
}
+ ///
+ /// Gets the dynamic view data dictionary.
+ ///
public dynamic ViewBag
{
get
@@ -821,6 +830,10 @@ namespace Microsoft.AspNet.Mvc.Razor
EndContext();
}
+ ///
+ /// In a Razor layout page, renders the portion of a content page that is not within a named section.
+ ///
+ /// The HTML content to render.
protected virtual HelperResult RenderBody()
{
if (RenderBodyDelegateAsync == null)
@@ -858,6 +871,11 @@ namespace Microsoft.AspNet.Mvc.Razor
SectionWriters[name] = section;
}
+ ///
+ /// Returns a value that indicates whether the specified section is defined in the content page.
+ ///
+ /// The section name to search for.
+ /// true if the specified section is defined in the content page; otherwise, false.
public bool IsSectionDefined(string name)
{
if (name == null)
diff --git a/src/Microsoft.AspNet.Mvc.Razor/RazorPageOfT.cs b/src/Microsoft.AspNet.Mvc.Razor/RazorPageOfT.cs
index aaab8bff20..0a115007d8 100644
--- a/src/Microsoft.AspNet.Mvc.Razor/RazorPageOfT.cs
+++ b/src/Microsoft.AspNet.Mvc.Razor/RazorPageOfT.cs
@@ -19,6 +19,9 @@ namespace Microsoft.AspNet.Mvc.Razor
{
private IModelMetadataProvider _provider;
+ ///
+ /// Gets the Model property of the property.
+ ///
public TModel Model
{
get
@@ -27,6 +30,9 @@ namespace Microsoft.AspNet.Mvc.Razor
}
}
+ ///
+ /// Gets or sets the dictionary for view data.
+ ///
[RazorInject]
public ViewDataDictionary ViewData { get; set; }
diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/MultiSelectList.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/MultiSelectList.cs
index 6622c5df3f..434072cfbe 100644
--- a/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/MultiSelectList.cs
+++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/MultiSelectList.cs
@@ -10,6 +10,11 @@ using Microsoft.AspNet.Mvc.ViewFeatures;
namespace Microsoft.AspNet.Mvc.Rendering
{
+ ///
+ /// Represents a list that lets users select multiple items.
+ /// This class is typically rendered as an HTML <select multiple="multiple"> element with the specified collection
+ /// of objects.
+ ///
public class MultiSelectList : IEnumerable
{
private IList _groups;
diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/SelectList.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/SelectList.cs
index 915b2161bd..0cb5767e13 100644
--- a/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/SelectList.cs
+++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/SelectList.cs
@@ -6,6 +6,11 @@ using System.Collections;
namespace Microsoft.AspNet.Mvc.Rendering
{
+ ///
+ /// Represents a list that lets users select a single item.
+ /// This class is typically rendered as an HTML <select> element with the specified collection
+ /// of objects.
+ ///
public class SelectList : MultiSelectList
{
public SelectList(IEnumerable items)
diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/SelectListItem.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/SelectListItem.cs
index 4a2ee0dc9b..2e4d03be41 100644
--- a/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/SelectListItem.cs
+++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/SelectListItem.cs
@@ -3,10 +3,17 @@
namespace Microsoft.AspNet.Mvc.Rendering
{
+ ///
+ /// Represents an item in a or .
+ /// This class is typically rendered as an HTML <option> element with the specified
+ /// attribute values.
+ ///
public class SelectListItem
{
///
/// Gets or sets a value that indicates whether this is disabled.
+ /// This property is typically rendered as a disabled="disabled" attribute in the HTML
+ /// <option> element.
///
public bool Disabled { get; set; }
@@ -17,10 +24,24 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
public SelectListGroup Group { get; set; }
+ ///
+ /// Gets or sets a value that indicates whether this is selected.
+ /// This property is typically rendered as a selected="selected" attribute in the HTML
+ /// <option> element.
+ ///
public bool Selected { get; set; }
+ ///
+ /// Gets or sets a value that indicates the display text of this .
+ /// This property is typically rendered as the inner HTML in the HTML <option> element.
+ ///
public string Text { get; set; }
+ ///
+ /// Gets or sets a value that indicates the value of this .
+ /// This property is typically rendered as a value="..." attribute in the HTML
+ /// <option> element.
+ ///
public string Value { get; set; }
}
}
diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/TagBuilder.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/TagBuilder.cs
index 4cfeb648ab..bc02641e78 100644
--- a/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/TagBuilder.cs
+++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/TagBuilder.cs
@@ -14,11 +14,19 @@ using Microsoft.Extensions.WebEncoders;
namespace Microsoft.AspNet.Mvc.Rendering
{
+ ///
+ /// Contains methods and properties that are used to create HTML elements. This class is often used to write HTML
+ /// helpers and tag helpers.
+ ///
[DebuggerDisplay("{DebuggerToString()}")]
public class TagBuilder : IHtmlContent
{
private AttributeDictionary _attributes;
+ ///
+ /// Creates a new HTML tag that has the specified tag name.
+ ///
+ /// An HTML tag name.
public TagBuilder(string tagName)
{
if (string.IsNullOrEmpty(tagName))
@@ -47,8 +55,14 @@ namespace Microsoft.AspNet.Mvc.Rendering
}
}
+ ///
+ /// Gets the inner HTML content of the element.
+ ///
public IHtmlContentBuilder InnerHtml { get; }
+ ///
+ /// Gets the tag name for this tag.
+ ///
public string TagName { get; }
///
@@ -57,6 +71,12 @@ namespace Microsoft.AspNet.Mvc.Rendering
/// Defaults to .
public TagRenderMode TagRenderMode { get; set; } = TagRenderMode.Normal;
+ ///
+ /// Adds a CSS class to the list of CSS classes in the tag.
+ /// If there are already CSS classes on the tag then a space character and the new class will be appended to
+ /// the existing list.
+ ///
+ /// The CSS class name to add.
public void AddCssClass(string value)
{
string currentValue;
@@ -144,16 +164,24 @@ namespace Microsoft.AspNet.Mvc.Rendering
return stringBuffer.ToString();
}
- public void GenerateId(string name, string idAttributeDotReplacement)
+ ///
+ /// Generates a sanitized ID attribute for the tag by using the specified name.
+ ///
+ /// The name to use to generate an ID attribute.
+ ///
+ /// The (normally a single ) to substitute for invalid characters in
+ /// .
+ ///
+ public void GenerateId(string name, string invalidCharReplacement)
{
- if (idAttributeDotReplacement == null)
+ if (invalidCharReplacement == null)
{
- throw new ArgumentNullException(nameof(idAttributeDotReplacement));
+ throw new ArgumentNullException(nameof(invalidCharReplacement));
}
if (!Attributes.ContainsKey("id"))
{
- var sanitizedId = CreateSanitizedId(name, idAttributeDotReplacement);
+ var sanitizedId = CreateSanitizedId(name, invalidCharReplacement);
if (!string.IsNullOrEmpty(sanitizedId))
{
Attributes["id"] = sanitizedId;
diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/ValidateAntiForgeryTokenAttribute.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/ValidateAntiForgeryTokenAttribute.cs
index aa985606de..cc4e203bce 100644
--- a/src/Microsoft.AspNet.Mvc.ViewFeatures/ValidateAntiForgeryTokenAttribute.cs
+++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/ValidateAntiForgeryTokenAttribute.cs
@@ -9,6 +9,14 @@ using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNet.Mvc
{
+ ///
+ /// Specifies that the class or method that this attribute is applied validates the anti-forgery token.
+ /// If the anti-forgery token is not available, or if the token is invalid, the validation will fail
+ /// and the action method will not execute.
+ ///
+ ///
+ /// This attribute helps defend against cross-site request forgery. It won't prevent other forgery or tampering attacks.
+ ///
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class ValidateAntiForgeryTokenAttribute : Attribute, IFilterFactory, IOrderedFilter
{
diff --git a/src/Microsoft.AspNet.Mvc/MvcServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Mvc/MvcServiceCollectionExtensions.cs
index 9357d983c5..241a6b1df3 100644
--- a/src/Microsoft.AspNet.Mvc/MvcServiceCollectionExtensions.cs
+++ b/src/Microsoft.AspNet.Mvc/MvcServiceCollectionExtensions.cs
@@ -7,8 +7,16 @@ using Microsoft.AspNet.Mvc.Internal;
namespace Microsoft.Extensions.DependencyInjection
{
+ ///
+ /// Extension methods for setting up MVC services in an .
+ ///
public static class MvcServiceCollectionExtensions
{
+ ///
+ /// Adds MVC services to the specified .
+ ///
+ /// The to add services to.
+ /// A reference to this instance after the operation has completed.
public static IMvcBuilder AddMvc(this IServiceCollection services)
{
if (services == null)
@@ -19,6 +27,12 @@ namespace Microsoft.Extensions.DependencyInjection
return AddMvc(services, setupAction: null);
}
+ ///
+ /// Adds MVC services to the specified .
+ ///
+ /// The to add services to.
+ /// An action delegate to configure the provided .
+ /// A reference to this instance after the operation has completed.
public static IMvcBuilder AddMvc(this IServiceCollection services, Action setupAction)
{
if (services == null)
diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/TagBuilderTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/TagBuilderTest.cs
index bdfb62fbae..e0786dc541 100644
--- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/TagBuilderTest.cs
+++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/Rendering/TagBuilderTest.cs
@@ -65,7 +65,7 @@ namespace Microsoft.AspNet.Mvc.Core.Rendering
tagBuilder.Attributes.Add("ID", "something");
// Act
- tagBuilder.GenerateId("else", idAttributeDotReplacement: "-");
+ tagBuilder.GenerateId("else", invalidCharReplacement: "-");
// Assert
var attribute = Assert.Single(tagBuilder.Attributes);