Delete trailing whitespace
- #EngineeringDay - Total replaced: 660 Matching files: 270 in *.cs - Total replaced: 250 Matching files: 32 in all other files - Total replaced: 22 Matching files: 8 in a few stragglers Did not change files under following directories - test\Microsoft.AspNet.Mvc.Razor.Host.Test\TestFiles\Output - test\Microsoft.AspNet.Mvc.FunctionalTests\compiler\resources - test\WebSites\TagHelpersWebSite (Razor generates trailing whitespace in a case or two)
This commit is contained in:
parent
678226a6bf
commit
5e067cdb9e
|
|
@ -21,8 +21,8 @@ namespace MvcSample.Web
|
|||
if (action.AttributeRouteModel.Name == null)
|
||||
{
|
||||
action.AttributeRouteModel.Name = string.Format(
|
||||
"{0}_{1}",
|
||||
model.ControllerName,
|
||||
"{0}_{1}",
|
||||
model.ControllerName,
|
||||
action.ActionName);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace MvcSample.Web.Filters
|
|||
{
|
||||
controller.CustomUser.Log += "Age Enhanced!" + Environment.NewLine;
|
||||
}
|
||||
|
||||
|
||||
if (context.ActionArguments.TryGetValue("age", out age))
|
||||
{
|
||||
if (age is int)
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ namespace MvcSample.Web.Filters
|
|||
{
|
||||
public override void OnAuthorization(AuthorizationContext context)
|
||||
{
|
||||
if (!HasAllowAnonymous(context))
|
||||
if (!HasAllowAnonymous(context))
|
||||
{
|
||||
var user = context.HttpContext.User;
|
||||
var userIsAnonymous =
|
||||
user == null ||
|
||||
user.Identity == null ||
|
||||
var userIsAnonymous =
|
||||
user == null ||
|
||||
user.Identity == null ||
|
||||
!user.Identity.IsAuthenticated;
|
||||
|
||||
if(userIsAnonymous)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace MvcSample.Web.Filters
|
|||
}
|
||||
|
||||
var executedContext = await next();
|
||||
|
||||
|
||||
if (executedContext.Result is ViewResult)
|
||||
{
|
||||
// slow down outgoing view results
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ namespace MvcSample.Web
|
|||
{
|
||||
context.HttpContext.User = new ClaimsPrincipal(
|
||||
new ClaimsIdentity(
|
||||
new Claim[] {
|
||||
new Claim[] {
|
||||
new Claim("Permission", "CanViewPage"),
|
||||
new Claim(ClaimTypes.Role, "Administrator"),
|
||||
new Claim(ClaimTypes.NameIdentifier, "John")},
|
||||
new Claim(ClaimTypes.Role, "Administrator"),
|
||||
new Claim(ClaimTypes.NameIdentifier, "John")},
|
||||
"Basic"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace MvcSample.Web.Filters
|
|||
{
|
||||
private static readonly string[] _userNames = new[] { "Jon", "David", "Goliath" };
|
||||
private static int _index;
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return _userNames[_index++ % 3];
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace MvcSample.Web
|
|||
{
|
||||
var time = _timer.ElapsedMilliseconds;
|
||||
context.HttpContext.Response.Headers.Add(
|
||||
"ActionElapsedTime",
|
||||
"ActionElapsedTime",
|
||||
new string[] { time.ToString(CultureInfo.InvariantCulture) + " ms" });
|
||||
}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ namespace MvcSample.Web
|
|||
{
|
||||
var time = _timer.ElapsedMilliseconds;
|
||||
context.HttpContext.Response.Headers.Add(
|
||||
"ResultElapsedTime",
|
||||
"ResultElapsedTime",
|
||||
new string[] { time.ToString(CultureInfo.InvariantCulture) + " ms" });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ using Microsoft.Framework.DependencyInjection;
|
|||
using MvcSample.Web.Filters;
|
||||
using MvcSample.Web.Services;
|
||||
|
||||
#if ASPNET50
|
||||
#if ASPNET50
|
||||
using Autofac;
|
||||
using Microsoft.Framework.DependencyInjection.Autofac;
|
||||
#endif
|
||||
|
|
@ -55,10 +55,10 @@ namespace MvcSample.Web
|
|||
options.ViewLocationExpanders.Insert(0, expander);
|
||||
});
|
||||
|
||||
// Create the autofac container
|
||||
// Create the autofac container
|
||||
ContainerBuilder builder = new ContainerBuilder();
|
||||
|
||||
// Create the container and use the default application services as a fallback
|
||||
// Create the container and use the default application services as a fallback
|
||||
AutofacRegistration.Populate(
|
||||
builder,
|
||||
services,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
{
|
||||
await Html.RenderPartialAsync("_ApiDescription", item);
|
||||
}
|
||||
|
||||
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
|
@ -120,6 +120,6 @@
|
|||
{
|
||||
var propertyName = property.PropertyName;
|
||||
var propertyTypeName = property.ModelType.Name;
|
||||
|
||||
|
||||
<li>Property @propertyName is type @propertyTypeName and '@(property.Description ?? "no description")'</li>
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
internal static class TaskHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Waits for the task to complete and throws the first faulting exception if the task is faulted.
|
||||
/// Waits for the task to complete and throws the first faulting exception if the task is faulted.
|
||||
/// It preserves the original stack trace when throwing the exception.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
|
|
@ -23,11 +23,11 @@ namespace Microsoft.AspNet.Mvc
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Waits for the task to complete and throws the first faulting exception if the task is faulted.
|
||||
/// Waits for the task to complete and throws the first faulting exception if the task is faulted.
|
||||
/// It preserves the original stack trace when throwing the exception.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Invoking this method is equivalent to calling <see cref="Task{TResult}.Result"/> on the
|
||||
/// Invoking this method is equivalent to calling <see cref="Task{TResult}.Result"/> on the
|
||||
/// <paramref name="task"/> if it is not completed.
|
||||
/// </remarks>
|
||||
public static TVal WaitAndThrowIfFaulted<TVal>(Task<TVal> task)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// <param name="action">The <see cref="ActionDescriptor"/> for which constraints are being created.</param>
|
||||
/// <param name="items">The list of <see cref="ActionConstraintItem"/> objects.</param>
|
||||
public ActionConstraintProviderContext(
|
||||
[NotNull] ActionDescriptor action,
|
||||
[NotNull] ActionDescriptor action,
|
||||
[NotNull] IList<ActionConstraintItem> items)
|
||||
{
|
||||
Action = action;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// <param name="routeContext">The route context.</param>
|
||||
/// <param name="action">Information about the action.</param>
|
||||
/// <returns>
|
||||
/// <see langword="true"/> if the action selection is valid for the specified context;
|
||||
/// <see langword="true"/> if the action selection is valid for the specified context;
|
||||
/// otherwise, <see langword="false"/>.
|
||||
/// </returns>
|
||||
public abstract bool IsValidForRequest(RouteContext routeContext, ActionDescriptor action);
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// A default implementation of <see cref="INestedProvider{ActionConstraintProviderContext}"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This provider is able to provide an <see cref="IActionConstraint"/> instance when the
|
||||
/// <see cref="IActionConstraintMetadata"/> implements <see cref="IActionConstraint"/> or
|
||||
/// This provider is able to provide an <see cref="IActionConstraint"/> instance when the
|
||||
/// <see cref="IActionConstraintMetadata"/> implements <see cref="IActionConstraint"/> or
|
||||
/// <see cref="IActionConstraintFactory"/>/
|
||||
/// </remarks>
|
||||
public class DefaultActionConstraintProvider : INestedProvider<ActionConstraintProviderContext>
|
||||
|
|
@ -28,7 +28,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public int Order
|
||||
public int Order
|
||||
{
|
||||
get { return DefaultOrder.DefaultFrameworkSortOrder; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,35 +9,35 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Action constraints have the secondary effect of making an action with a constraint applied a better
|
||||
/// match than one without.
|
||||
///
|
||||
/// match than one without.
|
||||
///
|
||||
/// Consider two actions, 'A' and 'B' with the same action and controller name. Action 'A' only allows the
|
||||
/// HTTP POST method (via a constraint) and action 'B' has no constraints.
|
||||
///
|
||||
///
|
||||
/// If an incoming request is a POST, then 'A' is considered the best match because it both matches and
|
||||
/// has a constraint. If an incoming request uses any other verb, 'A' will not be valid for selection
|
||||
/// due to it's constraint, so 'B' is the best match.
|
||||
///
|
||||
///
|
||||
///
|
||||
///
|
||||
/// Action constraints are also grouped according to their order value. Any constraints with the same
|
||||
/// group value are considered to be part of the same application policy, and will be executed in the
|
||||
/// same stage.
|
||||
///
|
||||
///
|
||||
/// Stages run in ascending order based on the value of <see cref="Order"/>. Given a set of actions which
|
||||
/// are candidates for selection, the next stage to run is the lowest value of <see cref="Order"/> for any
|
||||
/// constraint of any candidate which is greater than the order of the last stage.
|
||||
///
|
||||
///
|
||||
/// Once the stage order is identified, each action has all of it's constraints in that stage executed.
|
||||
/// If any constraint does not match, then that action is not a candidate for selection. If any actions
|
||||
/// with constraints in the current state are still candidates, then those are the 'best' actions and this
|
||||
/// process will repeat with the next stage on the set of 'best' actions. If after processing the
|
||||
/// process will repeat with the next stage on the set of 'best' actions. If after processing the
|
||||
/// subsequent stages of the 'best' actions no candidates remain, this process will repeat on the set of
|
||||
/// 'other' candidate actions from this stage (those without a constraint).
|
||||
/// </remarks>
|
||||
public interface IActionConstraint : IActionConstraintMetadata
|
||||
{
|
||||
/// <summary>
|
||||
/// The constraint order.
|
||||
/// The constraint order.
|
||||
/// </summary>
|
||||
int Order { get; }
|
||||
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ using System;
|
|||
namespace Microsoft.AspNet.Mvc
|
||||
{
|
||||
/// <summary>
|
||||
/// A factory for <see cref="IActionConstraint"/>.
|
||||
/// A factory for <see cref="IActionConstraint"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="IActionConstraintFactory"/> will be invoked by <see cref="DefaultActionConstraintProvider"/>
|
||||
/// to create constraint instances for an action.
|
||||
///
|
||||
///
|
||||
/// Place an attribute implementing this interface on a controller or action to insert an action
|
||||
/// constraint created by a factory.
|
||||
/// </remarks>
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@ namespace Microsoft.AspNet.Mvc
|
|||
public ModelStateDictionary ModelState { get; private set; }
|
||||
|
||||
public ActionDescriptor ActionDescriptor { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Input formatters associated with this context.
|
||||
/// Input formatters associated with this context.
|
||||
/// The formatters are populated only after IInputFormattersProvider runs.
|
||||
/// </summary>
|
||||
public IList<IInputFormatter> InputFormatters { get; set; }
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
public static class ActionDescriptorExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the value of a property from the <see cref="ActionDescriptor.Properties"/> collection
|
||||
/// Gets the value of a property from the <see cref="ActionDescriptor.Properties"/> collection
|
||||
/// using the provided value of <typeparamref name="T"/> as the key.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the property.</typeparam>
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
|
||||
if (ContentTypes == null || ContentTypes.Count == 0)
|
||||
{
|
||||
// Select based on sorted accept headers.
|
||||
// Select based on sorted accept headers.
|
||||
selectedFormatter = SelectFormatterUsingSortedAcceptHeaders(
|
||||
formatterContext,
|
||||
formatters,
|
||||
|
|
@ -78,17 +78,17 @@ namespace Microsoft.AspNet.Mvc
|
|||
MediaTypeHeaderValue incomingContentType = null;
|
||||
MediaTypeHeaderValue.TryParse(requestContentType, out incomingContentType);
|
||||
|
||||
// In case the incomingContentType is null (as can be the case with get requests),
|
||||
// we need to pick the first formatter which
|
||||
// can support writing this type.
|
||||
// In case the incomingContentType is null (as can be the case with get requests),
|
||||
// we need to pick the first formatter which
|
||||
// can support writing this type.
|
||||
var contentTypes = new[] { incomingContentType };
|
||||
selectedFormatter = SelectFormatterUsingAnyAcceptableContentType(
|
||||
formatterContext,
|
||||
formatters,
|
||||
contentTypes);
|
||||
|
||||
// This would be the case when no formatter could write the type base on the
|
||||
// accept headers and the request content type. Fallback on type based match.
|
||||
// This would be the case when no formatter could write the type base on the
|
||||
// accept headers and the request content type. Fallback on type based match.
|
||||
if (selectedFormatter == null)
|
||||
{
|
||||
foreach (var formatter in formatters)
|
||||
|
|
@ -116,7 +116,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
}
|
||||
else
|
||||
{
|
||||
// Filter and remove accept headers which cannot support any of the user specified content types.
|
||||
// Filter and remove accept headers which cannot support any of the user specified content types.
|
||||
var filteredAndSortedAcceptHeaders = sortedAcceptHeaders
|
||||
.Where(acceptHeader =>
|
||||
ContentTypes
|
||||
|
|
@ -134,9 +134,9 @@ namespace Microsoft.AspNet.Mvc
|
|||
|
||||
if (selectedFormatter == null)
|
||||
{
|
||||
// Either there were no acceptHeaders that were present OR
|
||||
// Either there were no acceptHeaders that were present OR
|
||||
// There were no accept headers which matched OR
|
||||
// There were acceptHeaders which matched but there was no formatter
|
||||
// There were acceptHeaders which matched but there was no formatter
|
||||
// which supported any of them.
|
||||
// In any of these cases, if the user has specified content types,
|
||||
// do a last effort to find a formatter which can write any of the user specified content type.
|
||||
|
|
@ -158,14 +158,14 @@ namespace Microsoft.AspNet.Mvc
|
|||
IOutputFormatter selectedFormatter = null;
|
||||
foreach (var contentType in sortedAcceptHeaders)
|
||||
{
|
||||
// Loop through each of the formatters and see if any one will support this
|
||||
// mediaType Value.
|
||||
// Loop through each of the formatters and see if any one will support this
|
||||
// mediaType Value.
|
||||
selectedFormatter = formatters.FirstOrDefault(
|
||||
formatter =>
|
||||
formatter.CanWriteResult(formatterContext, contentType));
|
||||
if (selectedFormatter != null)
|
||||
{
|
||||
// we found our match.
|
||||
// we found our match.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value",
|
||||
throw new ArgumentNullException("value",
|
||||
Resources.FormatPropertyOfTypeCannotBeNull(
|
||||
"FormFieldName", typeof(AntiForgeryOptions)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
FormToken = formToken;
|
||||
|
||||
// Cookie Token is allowed to be null in the case when the old cookie is valid
|
||||
// and there is no new cookieToken generated.
|
||||
// and there is no new cookieToken generated.
|
||||
CookieToken = cookieToken;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
private readonly AntiForgeryOptions _config;
|
||||
private readonly IAntiForgeryTokenSerializer _serializer;
|
||||
|
||||
internal AntiForgeryTokenStore([NotNull] AntiForgeryOptions config,
|
||||
|
||||
internal AntiForgeryTokenStore([NotNull] AntiForgeryOptions config,
|
||||
[NotNull] IAntiForgeryTokenSerializer serializer)
|
||||
{
|
||||
_config = config;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
private readonly AntiForgeryOptions _config;
|
||||
private readonly IAntiForgeryAdditionalDataProvider _additionalDataProvider;
|
||||
|
||||
internal TokenProvider(AntiForgeryOptions config,
|
||||
internal TokenProvider(AntiForgeryOptions config,
|
||||
IClaimUidExtractor claimUidExtractor,
|
||||
IAntiForgeryAdditionalDataProvider additionalDataProvider)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
{
|
||||
public class ActionModel
|
||||
{
|
||||
public ActionModel([NotNull] MethodInfo actionMethod,
|
||||
public ActionModel([NotNull] MethodInfo actionMethod,
|
||||
[NotNull] IReadOnlyList<object> attributes)
|
||||
{
|
||||
ActionMethod = actionMethod;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// If <c>true</c>, <see cref="Description.ApiDescription"/> objects will be created for the associated
|
||||
/// If <c>true</c>, <see cref="Description.ApiDescription"/> objects will be created for the associated
|
||||
/// controller or action.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
|
|
@ -35,7 +35,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
public bool? IsVisible { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The value for <see cref="Description.ApiDescription.GroupName"/> of
|
||||
/// The value for <see cref="Description.ApiDescription.GroupName"/> of
|
||||
/// <see cref="Description.ApiDescription"/> objects created for the associated controller or action.
|
||||
/// </summary>
|
||||
public string GroupName { get; set; }
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
/// <param name="applicationModel">The <see cref="ApplicationModel"/>.</param>
|
||||
/// <param name="conventions">The set of conventions.</param>
|
||||
public static void ApplyConventions(
|
||||
[NotNull] ApplicationModel applicationModel,
|
||||
[NotNull] ApplicationModel applicationModel,
|
||||
[NotNull] IEnumerable<IApplicationModelConvention> conventions)
|
||||
{
|
||||
// Conventions are applied from the outside-in to allow for scenarios where an action overrides
|
||||
|
|
|
|||
|
|
@ -372,7 +372,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
[Flags]
|
||||
private enum TemplateParserState : uint
|
||||
{
|
||||
// default state - allow non-special characters to pass through to the
|
||||
// default state - allow non-special characters to pass through to the
|
||||
// buffer.
|
||||
Plaintext = 0,
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
{
|
||||
public class ControllerModel
|
||||
{
|
||||
public ControllerModel([NotNull] TypeInfo controllerType,
|
||||
public ControllerModel([NotNull] TypeInfo controllerType,
|
||||
[NotNull] IReadOnlyList<object> attributes)
|
||||
{
|
||||
ControllerType = controllerType;
|
||||
|
|
|
|||
|
|
@ -40,12 +40,12 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
// If the attribute that 'defines' a route is NOT an IActionHttpMethodProvider, then we'll include with
|
||||
// it, any IActionHttpMethodProvider that are 'silent' IRouteTemplateProviders. In this case the 'extra'
|
||||
// action for silent route providers isn't needed.
|
||||
//
|
||||
//
|
||||
// Ex:
|
||||
// [HttpGet]
|
||||
// [AcceptVerbs("POST", "PUT")]
|
||||
// [HttpPost("Api/Things")]
|
||||
// public void DoThing()
|
||||
// public void DoThing()
|
||||
//
|
||||
// This will generate 2 actions:
|
||||
// 1. [HttpPost("Api/Things")]
|
||||
|
|
@ -54,7 +54,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
// Note that having a route attribute that doesn't define a route template _might_ be an error. We
|
||||
// don't have enough context to really know at this point so we just pass it on.
|
||||
var routeProviders = new List<object>();
|
||||
|
||||
|
||||
var createActionForSilentRouteProviders = false;
|
||||
foreach (var attribute in attributes)
|
||||
{
|
||||
|
|
@ -84,7 +84,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
// [HttpGet]
|
||||
// [HttpPost("Products")]
|
||||
// public void Foo() { }
|
||||
//
|
||||
//
|
||||
// Is two actions. And...
|
||||
//
|
||||
// [HttpGet]
|
||||
|
|
@ -242,14 +242,14 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
/// <returns>An <see cref="ActionModel"/> for the given <see cref="MethodInfo"/>.</returns>
|
||||
/// <remarks>
|
||||
/// An action-method in code may expand into multiple <see cref="ActionModel"/> instances depending on how
|
||||
/// the action is routed. In the case of multiple routing attributes, this method will invoked be once for
|
||||
/// the action is routed. In the case of multiple routing attributes, this method will invoked be once for
|
||||
/// each action that can be created.
|
||||
///
|
||||
///
|
||||
/// If overriding this method, use the provided <paramref name="attributes"/> list to find metadata related to
|
||||
/// the action being created.
|
||||
/// </remarks>
|
||||
protected virtual ActionModel CreateActionModel(
|
||||
[NotNull] MethodInfo methodInfo,
|
||||
[NotNull] MethodInfo methodInfo,
|
||||
[NotNull] IReadOnlyList<object> attributes)
|
||||
{
|
||||
var actionModel = new ActionModel(methodInfo, attributes)
|
||||
|
|
@ -289,7 +289,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
.SelectMany(a => a.HttpMethods)
|
||||
.Distinct());
|
||||
|
||||
var routeTemplateProvider =
|
||||
var routeTemplateProvider =
|
||||
attributes
|
||||
.OfType<IRouteTemplateProvider>()
|
||||
.Where(a => !IsSilentRouteAttribute(a))
|
||||
|
|
@ -325,8 +325,8 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
|
||||
private bool IsSilentRouteAttribute(IRouteTemplateProvider routeTemplateProvider)
|
||||
{
|
||||
return
|
||||
routeTemplateProvider.Template == null &&
|
||||
return
|
||||
routeTemplateProvider.Template == null &&
|
||||
routeTemplateProvider.Order == null &&
|
||||
routeTemplateProvider.Name == null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using System.Reflection;
|
|||
namespace Microsoft.AspNet.Mvc.ApplicationModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a set of <see cref="ActionModel"/> for a method.
|
||||
/// Creates a set of <see cref="ActionModel"/> for a method.
|
||||
/// </summary>
|
||||
public interface IActionModelBuilder
|
||||
{
|
||||
|
|
@ -21,7 +21,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
/// <returns>A set of <see cref="ActionModel"/> or null.</returns>
|
||||
/// <remarks>
|
||||
/// Instances of <see cref="ActionModel"/> returned from this interface should have their
|
||||
/// <see cref="ActionModel.Parameters"/> initialized.
|
||||
/// <see cref="ActionModel.Parameters"/> initialized.
|
||||
/// </remarks>
|
||||
IEnumerable<ActionModel> BuildActionModels([NotNull] TypeInfo typeInfo, [NotNull] MethodInfo methodInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
/// <remarks>
|
||||
/// To use this interface, create an <see cref="System.Attribute"/> class which implements the interface and
|
||||
/// place it on an action method.
|
||||
///
|
||||
/// <see cref="IActionModelConvention"/> customizations run after
|
||||
/// <see cref="IActionModelConvention"/> customications and before
|
||||
///
|
||||
/// <see cref="IActionModelConvention"/> customizations run after
|
||||
/// <see cref="IActionModelConvention"/> customications and before
|
||||
/// <see cref="IParameterModelConvention"/> customizations.
|
||||
/// </remarks>
|
||||
public interface IActionModelConvention
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
/// <remarks>
|
||||
/// Implementaions of this interface can be registered in <see cref="MvcOptions.ApplicationModelConventions"/>
|
||||
/// to customize metadata about the application.
|
||||
///
|
||||
///
|
||||
/// <see cref="IApplicationModelConvention"/> run before other types of customizations to the
|
||||
/// reflected model.
|
||||
/// </remarks>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using System.Reflection;
|
|||
namespace Microsoft.AspNet.Mvc.ApplicationModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a set of <see cref="ControllerModel"/> for a type.
|
||||
/// Creates a set of <see cref="ControllerModel"/> for a type.
|
||||
/// </summary>
|
||||
public interface IControllerModelBuilder
|
||||
{
|
||||
|
|
@ -18,7 +18,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
/// <returns>A <see cref="ControllerModel"/> or null.</returns>
|
||||
/// <remarks>
|
||||
/// Instances of <see cref="ControllerModel"/> returned from this interface should have their
|
||||
/// <see cref="ControllerModel.Actions"/> initialized.
|
||||
/// <see cref="ControllerModel.Actions"/> initialized.
|
||||
/// </remarks>
|
||||
ControllerModel BuildControllerModel([NotNull] TypeInfo typeInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
/// <remarks>
|
||||
/// To use this interface, create an <see cref="System.Attribute"/> class which implements the interface and
|
||||
/// place it on a controller class.
|
||||
///
|
||||
/// <see cref="IControllerModelConvention"/> customizations run after
|
||||
/// <see cref="IApplicationModelConvention"/> customizations and before
|
||||
///
|
||||
/// <see cref="IControllerModelConvention"/> customizations run after
|
||||
/// <see cref="IApplicationModelConvention"/> customizations and before
|
||||
/// <see cref="IActionModelConvention"/> customizations.
|
||||
/// </remarks>
|
||||
public interface IControllerModelConvention
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
/// <remarks>
|
||||
/// To use this interface, create an <see cref="System.Attribute"/> class which implements the interface and
|
||||
/// place it on an action method parameter.
|
||||
///
|
||||
/// <see cref="IParameterModelConvention"/> customizations run after
|
||||
///
|
||||
/// <see cref="IParameterModelConvention"/> customizations run after
|
||||
/// <see cref="IActionModelConvention"/> customizations.
|
||||
/// </remarks>
|
||||
public interface IParameterModelConvention
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Microsoft.AspNet.Mvc.ApplicationModels
|
|||
{
|
||||
public class ParameterModel
|
||||
{
|
||||
public ParameterModel([NotNull] ParameterInfo parameterInfo,
|
||||
public ParameterModel([NotNull] ParameterInfo parameterInfo,
|
||||
[NotNull] IReadOnlyList<object> attributes)
|
||||
{
|
||||
ParameterInfo = parameterInfo;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
public static class ControllerActionExecutor
|
||||
{
|
||||
private static readonly MethodInfo _convertOfTMethod =
|
||||
private static readonly MethodInfo _convertOfTMethod =
|
||||
typeof(ControllerActionExecutor).GetRuntimeMethods().Single(methodInfo => methodInfo.Name == "Convert");
|
||||
|
||||
// Method called via reflection.
|
||||
|
|
@ -24,8 +24,8 @@ namespace Microsoft.AspNet.Mvc
|
|||
}
|
||||
|
||||
public static async Task<object> ExecuteAsync(
|
||||
MethodInfo actionMethodInfo,
|
||||
object instance,
|
||||
MethodInfo actionMethodInfo,
|
||||
object instance,
|
||||
IDictionary<string, object> actionArguments)
|
||||
{
|
||||
var orderedArguments = PrepareArguments(actionArguments, actionMethodInfo.GetParameters());
|
||||
|
|
@ -33,8 +33,8 @@ namespace Microsoft.AspNet.Mvc
|
|||
}
|
||||
|
||||
public static async Task<object> ExecuteAsync(
|
||||
MethodInfo actionMethodInfo,
|
||||
object instance,
|
||||
MethodInfo actionMethodInfo,
|
||||
object instance,
|
||||
object[] orderedActionArguments)
|
||||
{
|
||||
object invocationResult = null;
|
||||
|
|
@ -50,9 +50,9 @@ namespace Microsoft.AspNet.Mvc
|
|||
}
|
||||
|
||||
return await CoerceResultToTaskAsync(
|
||||
invocationResult,
|
||||
actionMethodInfo.ReturnType,
|
||||
actionMethodInfo.Name,
|
||||
invocationResult,
|
||||
actionMethodInfo.ReturnType,
|
||||
actionMethodInfo.Name,
|
||||
actionMethodInfo.DeclaringType);
|
||||
}
|
||||
|
||||
|
|
@ -62,9 +62,9 @@ namespace Microsoft.AspNet.Mvc
|
|||
// Returning Task<object> enables us to await on the result.
|
||||
// This method is intentionally not using async pattern to keep jit time (on cold start) to a minimum.
|
||||
private static Task<object> CoerceResultToTaskAsync(
|
||||
object result,
|
||||
Type returnType,
|
||||
string methodName,
|
||||
object result,
|
||||
Type returnType,
|
||||
string methodName,
|
||||
Type declaringType)
|
||||
{
|
||||
// If it is either a Task or Task<T>
|
||||
|
|
@ -92,7 +92,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
// 1. Types which have derived from Task and Task<T>,
|
||||
// 2. Action methods which use dynamic keyword but return a Task or Task<T>.
|
||||
throw new InvalidOperationException(Resources.FormatActionExecutor_UnexpectedTaskInstance(
|
||||
methodName,
|
||||
methodName,
|
||||
declaringType));
|
||||
}
|
||||
else
|
||||
|
|
@ -102,7 +102,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
}
|
||||
|
||||
private static object[] PrepareArguments(
|
||||
IDictionary<string, object> actionParameters,
|
||||
IDictionary<string, object> actionParameters,
|
||||
ParameterInfo[] declaredParameterInfos)
|
||||
{
|
||||
var count = declaredParameterInfos.Length;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
_controllerFactory.ReleaseController(ActionContext.Controller);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override async Task<IActionResult> InvokeActionAsync(ActionExecutingContext actionExecutingContext)
|
||||
{
|
||||
var actionMethodInfo = _descriptor.MethodInfo;
|
||||
|
|
@ -94,7 +94,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
};
|
||||
}
|
||||
|
||||
// Unwrap potential Task<T> types.
|
||||
// Unwrap potential Task<T> types.
|
||||
var actualReturnType = TypeHelper.GetTaskInnerTypeOrNull(declaredReturnType) ?? declaredReturnType;
|
||||
if (actionReturnValue == null && typeof(IActionResult).IsAssignableFrom(actualReturnType))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// <summary>
|
||||
/// Returns a cached collection of <see cref="ActionDescriptor" />.
|
||||
/// </summary>
|
||||
public ActionDescriptorsCollection ActionDescriptors
|
||||
public ActionDescriptorsCollection ActionDescriptors
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
@ -42,8 +42,8 @@ namespace Microsoft.AspNet.Mvc
|
|||
|
||||
private ActionDescriptorsCollection GetCollection()
|
||||
{
|
||||
var actionDescriptorProvider =
|
||||
_serviceProvider.GetRequiredService<INestedProviderManager<ActionDescriptorProviderContext>>();
|
||||
var actionDescriptorProvider =
|
||||
_serviceProvider.GetRequiredService<INestedProviderManager<ActionDescriptorProviderContext>>();
|
||||
var actionDescriptorProviderContext = new ActionDescriptorProviderContext();
|
||||
|
||||
actionDescriptorProvider.Invoke(actionDescriptorProviderContext);
|
||||
|
|
|
|||
|
|
@ -129,11 +129,11 @@ namespace Microsoft.AspNet.Mvc
|
|||
}
|
||||
|
||||
private IReadOnlyList<ActionSelectorCandidate> EvaluateActionConstraints(
|
||||
RouteContext context,
|
||||
IReadOnlyList<ActionSelectorCandidate> candidates,
|
||||
RouteContext context,
|
||||
IReadOnlyList<ActionSelectorCandidate> candidates,
|
||||
int? startingOrder)
|
||||
{
|
||||
// Find the next group of constraints to process. This will be the lowest value of
|
||||
// Find the next group of constraints to process. This will be the lowest value of
|
||||
// order that is higher than startingOrder.
|
||||
int? order = null;
|
||||
foreach (var candidate in candidates)
|
||||
|
|
@ -265,7 +265,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
|
||||
_actionConstraintProvider.Invoke(context);
|
||||
|
||||
return
|
||||
return
|
||||
context.Results
|
||||
.Where(item => item.Constraint != null)
|
||||
.Select(item => item.Constraint)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
private readonly ITypeActivator _typeActivator;
|
||||
private readonly IControllerActivator _controllerActivator;
|
||||
|
||||
public DefaultControllerFactory(IServiceProvider serviceProvider,
|
||||
public DefaultControllerFactory(IServiceProvider serviceProvider,
|
||||
ITypeActivator typeActivator,
|
||||
IControllerActivator controllerActivator)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace Microsoft.AspNet.Mvc.OptionDescriptors
|
|||
/// </summary>
|
||||
/// <param name="options">An accessor to the <see cref="MvcOptions"/> configured for this application.</param>
|
||||
/// <param name="typeActivator">An <see cref="ITypeActivator"/> instance used to instantiate types.</param>
|
||||
/// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
|
||||
/// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
|
||||
/// service collection.</param>
|
||||
public DefaultValidationExcludeFiltersProvider(IOptions<MvcOptions> optionsAccessor,
|
||||
ITypeActivator typeActivator,
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ namespace Microsoft.AspNet.Mvc.Description
|
|||
/// The CLR data type of the response or null.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Will be null if the action returns no response, or if the response type is unclear. Use
|
||||
/// Will be null if the action returns no response, or if the response type is unclear. Use
|
||||
/// <see cref="ProducesAttribute"/> on an action method to specify a response type.
|
||||
/// </remarks>
|
||||
public Type ResponseType { get; set; }
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@
|
|||
namespace Microsoft.AspNet.Mvc.Description
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents data used to build an <see cref="ApiDescription"/>, stored as part of the
|
||||
/// Represents data used to build an <see cref="ApiDescription"/>, stored as part of the
|
||||
/// <see cref="ActionDescriptor.Properties"/>.
|
||||
/// </summary>
|
||||
public class ApiDescriptionActionData
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="ApiDescription.GroupName"/> of <see cref="ApiDescription"/> objects for the associated
|
||||
/// The <see cref="ApiDescription.GroupName"/> of <see cref="ApiDescription"/> objects for the associated
|
||||
/// action.
|
||||
/// </summary>
|
||||
public string GroupName { get; set; }
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Microsoft.AspNet.Mvc.Description
|
|||
public static class ApiDescriptionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the value of a property from the <see cref="ApiDescription.Properties"/> collection
|
||||
/// Gets the value of a property from the <see cref="ApiDescription.Properties"/> collection
|
||||
/// using the provided value of <typeparamref name="T"/> as the key.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the property.</typeparam>
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// controller class or action method.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
|
||||
public class ApiExplorerSettingsAttribute :
|
||||
Attribute,
|
||||
IApiDescriptionGroupNameProvider,
|
||||
public class ApiExplorerSettingsAttribute :
|
||||
Attribute,
|
||||
IApiDescriptionGroupNameProvider,
|
||||
IApiDescriptionVisibilityProvider
|
||||
{
|
||||
/// <inheritdoc />
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace Microsoft.AspNet.Mvc.Description
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public int Order
|
||||
public int Order
|
||||
{
|
||||
get { return DefaultOrder.DefaultFrameworkSortOrder; }
|
||||
}
|
||||
|
|
@ -300,10 +300,10 @@ namespace Microsoft.AspNet.Mvc.Description
|
|||
}
|
||||
|
||||
private static IEnumerable<IRouteConstraint> GetConstraints(
|
||||
IInlineConstraintResolver constraintResolver,
|
||||
IInlineConstraintResolver constraintResolver,
|
||||
IEnumerable<InlineConstraint> constraints)
|
||||
{
|
||||
return
|
||||
return
|
||||
constraints
|
||||
.Select(c => constraintResolver.ResolveConstraint(c.Constraint))
|
||||
.Where(c => c != null)
|
||||
|
|
|
|||
|
|
@ -80,10 +80,10 @@ namespace Microsoft.AspNet.Mvc.Filters
|
|||
|
||||
// BinarySearch will return the index of where the item _should_be_ in the list.
|
||||
//
|
||||
// If index > 0:
|
||||
// If index > 0:
|
||||
// Other items in the list have the same order and scope - the item was 'found'.
|
||||
//
|
||||
// If index < 0:
|
||||
// If index < 0:
|
||||
// No other items in the list have the same order and scope - the item was not 'found'
|
||||
// Index will be the bitwise compliment of of the 'right' location.
|
||||
var index = context.Results.BinarySearch(item, FilterItemOrderComparer.Comparer);
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// <param name="filterType">Type representing an <see cref="IFilter"/>.</param>
|
||||
/// <returns>An <see cref="IFilter"/> representing the added service type.</returns>
|
||||
/// <remarks>
|
||||
/// Filter instances will created through dependency injection. Use
|
||||
/// Filter instances will created through dependency injection. Use
|
||||
/// <see cref="AddService(ICollection{IFilter}, Type)"/> to register a service that will be created via
|
||||
/// type activation.
|
||||
/// </remarks>
|
||||
|
|
@ -82,7 +82,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// <param name="order">The order of the added filter.</param>
|
||||
/// <returns>An <see cref="IFilter"/> representing the added service type.</returns>
|
||||
/// <remarks>
|
||||
/// Filter instances will created through dependency injection. Use
|
||||
/// Filter instances will created through dependency injection. Use
|
||||
/// <see cref="AddService(ICollection{IFilter}, Type)"/> to register a service that will be created via
|
||||
/// type activation.
|
||||
/// </remarks>
|
||||
|
|
|
|||
|
|
@ -7,15 +7,15 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// Descriptor for an <see cref="IFilter"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="FilterDescriptor"/> describes an <see cref="IFilter"/> with an order and scope.
|
||||
///
|
||||
/// <see cref="FilterDescriptor"/> describes an <see cref="IFilter"/> with an order and scope.
|
||||
///
|
||||
/// Order and scope control the execution order of filters. Filters with a higher value of Order execute
|
||||
/// later in the pipeline.
|
||||
///
|
||||
/// later in the pipeline.
|
||||
///
|
||||
/// When filters have the same Order, the Scope value is used to determine the order of execution. Filters
|
||||
/// with a higher value of Scope execute later in the pipeline. See <see cref="FilterScope"/> for commonly
|
||||
/// used scopes.
|
||||
///
|
||||
///
|
||||
/// For <see cref="IExceptionFilter"/> implementions, the filter runs only after an exception has occurred,
|
||||
/// and so the observed order of execution will be opposite that of other filters.
|
||||
/// </remarks>
|
||||
|
|
@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// <param name="filter">The <see cref="IFilter"/>.</param>
|
||||
/// <param name="filterScope">The filter scope.</param>
|
||||
/// <remarks>
|
||||
/// If the <paramref name="filter"/> implements <see cref="IOrderedFilter"/>, then the value of
|
||||
/// If the <paramref name="filter"/> implements <see cref="IOrderedFilter"/>, then the value of
|
||||
/// <see cref="Order"/> will be taken from <see cref="IOrderedFilter.Order"/>. Otherwise the value
|
||||
/// of <see cref="Order"/> will default to <c>0</c>.
|
||||
/// </remarks>
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
namespace Microsoft.AspNet.Mvc
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains constant values for known filter scopes.
|
||||
///
|
||||
/// Contains constant values for known filter scopes.
|
||||
///
|
||||
/// Scope defines the ordering of filters that have the same order. Scope is by-default
|
||||
/// defined by how a filter is registered.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ using Microsoft.AspNet.Mvc.HeaderValueAbstractions;
|
|||
namespace Microsoft.AspNet.Mvc
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the allowed content types and the type of the value returned by the action
|
||||
/// Specifies the allowed content types and the type of the value returned by the action
|
||||
/// which can be used to select a formatter while executing <see cref="ObjectResult"/>.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
public class ValidateAntiForgeryTokenAuthorizationFilter : IAsyncAuthorizationFilter
|
||||
{
|
||||
private readonly AntiForgery _antiForgery;
|
||||
|
||||
|
||||
public ValidateAntiForgeryTokenAuthorizationFilter([NotNull] AntiForgery antiForgery)
|
||||
{
|
||||
_antiForgery = antiForgery;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
return formatter;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace Microsoft.AspNet.Mvc.OptionDescriptors
|
|||
/// </summary>
|
||||
/// <param name="options">An accessor to the <see cref="MvcOptions"/> configured for this application.</param>
|
||||
/// <param name="typeActivator">An <see cref="ITypeActivator"/> instance used to instantiate types.</param>
|
||||
/// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
|
||||
/// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
|
||||
/// service collection.</param>
|
||||
public DefaultInputFormattersProvider(IOptions<MvcOptions> optionsAccessor,
|
||||
ITypeActivator typeActivator,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// </summary>
|
||||
/// <param name="options">An accessor to the <see cref="MvcOptions"/> configured for this application.</param>
|
||||
/// <param name="typeActivator">An <see cref="ITypeActivator"/> instance used to instantiate types.</param>
|
||||
/// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
|
||||
/// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
|
||||
/// service collection.</param>
|
||||
public DefaultOutputFormattersProvider(IOptions<MvcOptions> optionsAccessor,
|
||||
ITypeActivator typeActivator,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using Microsoft.AspNet.Mvc.ModelBinding;
|
|||
namespace Microsoft.AspNet.Mvc
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides an implementation of <see cref="IExcludeTypeValidationFilter"/> which can filter
|
||||
/// Provides an implementation of <see cref="IExcludeTypeValidationFilter"/> which can filter
|
||||
/// based on a type.
|
||||
/// </summary>
|
||||
public class DefaultTypeBasedExcludeFilter : IExcludeTypeValidationFilter
|
||||
|
|
@ -30,6 +30,6 @@ namespace Microsoft.AspNet.Mvc
|
|||
public bool IsTypeExcluded([NotNull] Type propertyType)
|
||||
{
|
||||
return ExcludedType.IsAssignableFrom(propertyType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using Microsoft.AspNet.Mvc.ModelBinding;
|
|||
namespace Microsoft.AspNet.Mvc
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides an implementation of <see cref="IExcludeTypeValidationFilter"/> which can filter
|
||||
/// Provides an implementation of <see cref="IExcludeTypeValidationFilter"/> which can filter
|
||||
/// based on a type full name.
|
||||
/// </summary>
|
||||
public class DefaultTypeNameBasedExcludeFilter : IExcludeTypeValidationFilter
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// <inheritdoc />
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
// No-op. In CoreCLR this is equivalent to Close.
|
||||
// No-op. In CoreCLR this is equivalent to Close.
|
||||
// Given that we don't own the underlying stream, we never want to do anything interesting here.
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
public bool CanWriteResult(OutputFormatterContext context, MediaTypeHeaderValue contentType)
|
||||
{
|
||||
// ignore the contentType and just look at the content.
|
||||
// This formatter will be selected if the content is null.
|
||||
// This formatter will be selected if the content is null.
|
||||
// We check for Task as a user can directly create an ObjectContentResult with the unwrapped type.
|
||||
if(context.DeclaredType == typeof(void) || context.DeclaredType == typeof(Task))
|
||||
{
|
||||
|
|
@ -33,8 +33,8 @@ namespace Microsoft.AspNet.Mvc
|
|||
}
|
||||
|
||||
public IReadOnlyList<MediaTypeHeaderValue> GetSupportedContentTypes(
|
||||
Type declaredType,
|
||||
Type runtimeType,
|
||||
Type declaredType,
|
||||
Type runtimeType,
|
||||
MediaTypeHeaderValue contentType)
|
||||
{
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// an object of the specified type.
|
||||
/// </summary>
|
||||
/// <param name="context">Input formatter context associated with this call.</param>
|
||||
/// <returns>True if this <see cref="IInputFormatter"/> supports the passed in
|
||||
/// <returns>True if this <see cref="IInputFormatter"/> supports the passed in
|
||||
/// request's content-type and is able to de-serialize the request body.
|
||||
/// False otherwise.</returns>
|
||||
bool CanRead(InputFormatterContext context);
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// An output formatter that specializes in writing JSON content.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <see cref="JsonResult"/> class filter the collection of
|
||||
/// The <see cref="JsonResult"/> class filter the collection of
|
||||
/// <see cref="IOutputFormattersProvider.OutputFormatters"/> and use only those which implement
|
||||
/// <see cref="IJsonOutputFormatter"/>.
|
||||
///
|
||||
///
|
||||
/// To create a custom formatter that can be used by <see cref="JsonResult"/>, derive from
|
||||
/// <see cref="JsonOutputFormatter"/> or implement <see cref="IJsonOutputFormatter"/>.
|
||||
/// </remarks>
|
||||
|
|
|
|||
|
|
@ -19,28 +19,28 @@ namespace Microsoft.AspNet.Mvc
|
|||
public interface IOutputFormatter
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a filtered list of content types which are supported by this formatter
|
||||
/// Gets a filtered list of content types which are supported by this formatter
|
||||
/// for the <paramref name="declaredType"/> and <paramref name="contentType"/>.
|
||||
/// </summary>
|
||||
/// <param name="declaredType">The declared type for which the supported content types are desired.</param>
|
||||
/// <param name="runtimeType">The runtime type for which the supported content types are desired.</param>
|
||||
/// <param name="contentType">
|
||||
/// The content type for which the supported content types are desired, or <c>null</c> if any content
|
||||
/// The content type for which the supported content types are desired, or <c>null</c> if any content
|
||||
/// type can be used.
|
||||
/// </param>
|
||||
/// <returns>Content types which are supported by this formatter.</returns>
|
||||
/// <remarks>
|
||||
/// If the value of <paramref name="contentType"/> is <c>null</c>, then the formatter should return a list
|
||||
/// of all content types that it can produce for the given data type. This may occur during content
|
||||
/// of all content types that it can produce for the given data type. This may occur during content
|
||||
/// negotiation when the HTTP Accept header is not specified, or when no match for the value in the Accept
|
||||
/// header can be found.
|
||||
///
|
||||
///
|
||||
/// If the value of <paramref name="contentType"/> is not <c>null</c>, then the formatter should return
|
||||
/// a list of all content types that it can produce which match the given data type and content type.
|
||||
/// </remarks>
|
||||
IReadOnlyList<MediaTypeHeaderValue> GetSupportedContentTypes(
|
||||
Type declaredType,
|
||||
Type runtimeType,
|
||||
Type declaredType,
|
||||
Type runtimeType,
|
||||
MediaTypeHeaderValue contentType);
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -49,7 +49,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// </summary>
|
||||
/// <param name="context">The formatter context associated with the call.</param>
|
||||
/// <param name="contentType">The desired contentType on the response.</param>
|
||||
/// <returns>True if this <see cref="IOutputFormatter"/> supports the passed in
|
||||
/// <returns>True if this <see cref="IOutputFormatter"/> supports the passed in
|
||||
/// <paramref name="contentType"/> and is able to serialize the object
|
||||
/// represent by <paramref name="context"/>'s Object property.
|
||||
/// False otherwise.</returns>
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets if deserialization errors are captured. When set, these errors appear in
|
||||
/// Gets or sets if deserialization errors are captured. When set, these errors appear in
|
||||
/// the <see cref="ActionContext.ModelState"/> instance of <see cref="InputFormatterContext"/>.
|
||||
/// </summary>
|
||||
public bool CaptureDeserilizationErrors { get; set; }
|
||||
|
|
@ -150,7 +150,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
var exception = e.ErrorContext.Error;
|
||||
context.ActionContext.ModelState.TryAddModelError(e.ErrorContext.Path, e.ErrorContext.Error);
|
||||
// Error must always be marked as handled
|
||||
// Failure to do so can cause the exception to be rethrown at every recursive level and
|
||||
// Failure to do so can cause the exception to be rethrown at every recursive level and
|
||||
// overflow the stack for x64 CLR processes
|
||||
e.ErrorContext.Handled = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
public class JsonOutputFormatter : OutputFormatter, IJsonOutputFormatter
|
||||
{
|
||||
private JsonSerializerSettings _serializerSettings;
|
||||
|
||||
|
||||
public JsonOutputFormatter()
|
||||
{
|
||||
SupportedEncodings.Add(Encodings.UTF8EncodingWithoutBOM);
|
||||
|
|
@ -22,7 +22,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
|
||||
_serializerSettings = new JsonSerializerSettings();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the <see cref="JsonSerializerSettings"/> used to configure the <see cref="JsonSerializer"/>.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// </summary>
|
||||
public class MediaTypeWithQualityHeaderValueComparer : IComparer<MediaTypeWithQualityHeaderValue>
|
||||
{
|
||||
private static readonly MediaTypeWithQualityHeaderValueComparer _mediaTypeComparer =
|
||||
private static readonly MediaTypeWithQualityHeaderValueComparer _mediaTypeComparer =
|
||||
new MediaTypeWithQualityHeaderValueComparer();
|
||||
|
||||
private MediaTypeWithQualityHeaderValueComparer()
|
||||
|
|
|
|||
|
|
@ -133,8 +133,8 @@ namespace Microsoft.AspNet.Mvc
|
|||
MediaTypeHeaderValue mediaType = null;
|
||||
if (contentType == null)
|
||||
{
|
||||
// If the desired content type is set to null, the current formatter is free to choose the
|
||||
// response media type.
|
||||
// If the desired content type is set to null, the current formatter is free to choose the
|
||||
// response media type.
|
||||
mediaType = SupportedMediaTypes.FirstOrDefault();
|
||||
}
|
||||
else
|
||||
|
|
@ -185,7 +185,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
|
||||
context.SelectedEncoding = selectedEncoding;
|
||||
|
||||
// Override the content type value even if one already existed.
|
||||
// Override the content type value even if one already existed.
|
||||
selectedMediaType.Charset = selectedEncoding.WebName;
|
||||
|
||||
context.SelectedContentType = context.SelectedContentType ?? selectedMediaType;
|
||||
|
|
|
|||
|
|
@ -8,28 +8,28 @@ using Microsoft.AspNet.Mvc.HeaderValueAbstractions;
|
|||
namespace Microsoft.AspNet.Mvc
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents information used by a formatter for participating in
|
||||
/// output content negotiation and in writing out the response.
|
||||
/// Represents information used by a formatter for participating in
|
||||
/// output content negotiation and in writing out the response.
|
||||
/// </summary>
|
||||
public class OutputFormatterContext
|
||||
{
|
||||
/// <summary>
|
||||
/// The return value of the action method.
|
||||
/// The return value of the action method.
|
||||
/// </summary>
|
||||
public object Object { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The declared return type of the action.
|
||||
/// The declared return type of the action.
|
||||
/// </summary>
|
||||
public Type DeclaredType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Action context associated with the current call.
|
||||
/// Action context associated with the current call.
|
||||
/// </summary>
|
||||
public ActionContext ActionContext { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The encoding which is chosen by the selected formatter.
|
||||
/// The encoding which is chosen by the selected formatter.
|
||||
/// </summary>
|
||||
public Encoding SelectedEncoding { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
/// <summary>
|
||||
/// Implementation of <see cref="IComparer{T}"/> that can compare content negotiation header fields
|
||||
/// based on their quality values (a.k.a q-values). This applies to values used in accept-charset,
|
||||
/// accept-encoding, accept-language and related header fields with similar syntax rules. See
|
||||
/// <see cref="MediaTypeWithQualityHeaderValueComparer"/> for a comparer for media type
|
||||
/// based on their quality values (a.k.a q-values). This applies to values used in accept-charset,
|
||||
/// accept-encoding, accept-language and related header fields with similar syntax rules. See
|
||||
/// <see cref="MediaTypeWithQualityHeaderValueComparer"/> for a comparer for media type
|
||||
/// q-values.
|
||||
/// </summary>
|
||||
internal class StringWithQualityHeaderValueComparer : IComparer<StringWithQualityHeaderValue>
|
||||
|
|
@ -29,7 +29,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compares two <see cref="StringWithQualityHeaderValue"/> based on their quality value
|
||||
/// Compares two <see cref="StringWithQualityHeaderValue"/> based on their quality value
|
||||
/// (a.k.a their "q-value").
|
||||
/// Values with identical q-values are considered equal (i.e the result is 0) with the exception of wild-card
|
||||
/// values (i.e. a value of "*") which are considered less than non-wild-card values. This allows to sort
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
|
||||
public override bool CanWriteResult(OutputFormatterContext context, MediaTypeHeaderValue contentType)
|
||||
{
|
||||
// Ignore the passed in content type, if the object is string
|
||||
// Ignore the passed in content type, if the object is string
|
||||
// always return it as a text/plain format.
|
||||
if (context.DeclaredType == typeof(string))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
public interface IUrlHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Generates a fully qualified or absolute URL for an action method by using the specified action name,
|
||||
/// Generates a fully qualified or absolute URL for an action method by using the specified action name,
|
||||
/// controller name, route values, protocol to use, host name and fragment.
|
||||
/// </summary>
|
||||
/// <param name="action">The name of the action method.</param>
|
||||
|
|
@ -25,13 +25,13 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// Converts a virtual (relative) path to an application absolute path.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If the specified content path does not start with the tilde (~) character,
|
||||
/// If the specified content path does not start with the tilde (~) character,
|
||||
/// this method returns <paramref name="contentPath"/> unchanged.
|
||||
/// </remarks>
|
||||
/// <param name="contentPath">The virtual path of the content.</param>
|
||||
/// <returns>The application absolute path.</returns>
|
||||
string Content(string contentPath);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value that indicates whether the URL is local.
|
||||
/// </summary>
|
||||
|
|
@ -40,7 +40,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
bool IsLocalUrl(string url);
|
||||
|
||||
/// <summary>
|
||||
/// Generates a fully qualified or absolute URL for the specified route values by
|
||||
/// Generates a fully qualified or absolute URL for the specified route values by
|
||||
/// using the specified route name, protocol to use, host name and fragment.
|
||||
/// </summary>
|
||||
/// <param name="routeName">The name of the route that is used to generate URL.</param>
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ using System.Linq;
|
|||
|
||||
namespace Microsoft.AspNet.Mvc.Internal.DecisionTree
|
||||
{
|
||||
// This code generates a minimal tree of decision criteria that map known categorical data
|
||||
// (key-value-pairs) to a set of inputs. Action Selection is the best example of how this
|
||||
// can be used, so the comments here will describe the process from the point-of-view,
|
||||
// This code generates a minimal tree of decision criteria that map known categorical data
|
||||
// (key-value-pairs) to a set of inputs. Action Selection is the best example of how this
|
||||
// can be used, so the comments here will describe the process from the point-of-view,
|
||||
// though the decision tree is generally applicable to like-problems.
|
||||
//
|
||||
// Care has been taken here to keep the performance of building the data-structure at a
|
||||
|
|
@ -34,7 +34,7 @@ namespace Microsoft.AspNet.Mvc.Internal.DecisionTree
|
|||
//
|
||||
// The generated tree looks like this (json-like-notation):
|
||||
//
|
||||
// {
|
||||
// {
|
||||
// action : {
|
||||
// "AddUser" : {
|
||||
// controller : {
|
||||
|
|
@ -97,7 +97,7 @@ namespace Microsoft.AspNet.Mvc.Internal.DecisionTree
|
|||
DecisionCriterionValueEqualityComparer comparer,
|
||||
IList<ItemDescriptor<TItem>> items)
|
||||
{
|
||||
// The extreme use of generics here is intended to reduce the number of intermediate
|
||||
// The extreme use of generics here is intended to reduce the number of intermediate
|
||||
// allocations of wrapper classes. Performance testing found that building these trees allocates
|
||||
// significant memory that we can avoid and that it has a real impact on startup.
|
||||
var criteria = new Dictionary<string, Criterion>(StringComparer.OrdinalIgnoreCase);
|
||||
|
|
@ -221,7 +221,7 @@ namespace Microsoft.AspNet.Mvc.Internal.DecisionTree
|
|||
|
||||
public HashSet<ItemDescriptor<TItem>> MatchedItems { get; private set; }
|
||||
}
|
||||
|
||||
|
||||
// Subclass just to give a logical name to a mess of generics
|
||||
private class Criterion : Dictionary<DecisionCriterionValue, List<ItemDescriptor<TItem>>>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace Microsoft.AspNet.Mvc.Internal.Routing
|
|||
}
|
||||
|
||||
// We need to recursively walk the decision tree based on the provided route data
|
||||
// (context.Values + context.AmbientValues) to find all entries that match. This process is
|
||||
// (context.Values + context.AmbientValues) to find all entries that match. This process is
|
||||
// virtually identical to action selection.
|
||||
//
|
||||
// Each entry has a collection of 'required link values' that must be satisfied. These are
|
||||
|
|
@ -125,7 +125,7 @@ namespace Microsoft.AspNet.Mvc.Internal.Routing
|
|||
|
||||
private class AttributeRouteLinkGenerationEntryComparer : IComparer<AttributeRouteLinkGenerationEntry>
|
||||
{
|
||||
public static readonly AttributeRouteLinkGenerationEntryComparer Instance =
|
||||
public static readonly AttributeRouteLinkGenerationEntryComparer Instance =
|
||||
new AttributeRouteLinkGenerationEntryComparer();
|
||||
|
||||
public int Compare(AttributeRouteLinkGenerationEntry x, AttributeRouteLinkGenerationEntry y)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
if (valueAsString != null)
|
||||
{
|
||||
var allValues = GetAndCacheAllMatchingValues(routeKey, httpContext);
|
||||
var match = allValues.Any(existingRouteValue =>
|
||||
var match = allValues.Any(existingRouteValue =>
|
||||
existingRouteValue.Equals(
|
||||
valueAsString,
|
||||
StringComparison.OrdinalIgnoreCase));
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ namespace Microsoft.AspNet.Mvc.Logging
|
|||
{
|
||||
/// <summary>
|
||||
/// A formatter for use with <see cref="Microsoft.Framework.Logging.ILogger.Write(
|
||||
/// Framework.Logging.LogLevel,
|
||||
/// int,
|
||||
/// object,
|
||||
/// Framework.Logging.LogLevel,
|
||||
/// int,
|
||||
/// object,
|
||||
/// Exception, Func{object, Exception, string})"/>.
|
||||
/// </summary>
|
||||
public static string Formatter(object o, Exception e)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ using Microsoft.Framework.DependencyInjection;
|
|||
namespace Microsoft.AspNet.Mvc
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a model binder which understands <see cref="IFormatterBinderMetadata"/> and uses
|
||||
/// Represents a model binder which understands <see cref="IFormatterBinderMetadata"/> and uses
|
||||
/// InputFomatters to bind the model to request's body.
|
||||
/// </summary>
|
||||
public class BodyModelBinder : MetadataAwareBinder<IFormatterBinderMetadata>
|
||||
|
|
@ -31,7 +31,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
}
|
||||
|
||||
protected override async Task<bool> BindAsync(
|
||||
ModelBindingContext bindingContext,
|
||||
ModelBindingContext bindingContext,
|
||||
IFormatterBinderMetadata metadata)
|
||||
{
|
||||
var formatterContext = new InputFormatterContext(_actionContext, bindingContext.ModelType);
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
Resources.FormatActionInvokerFactory_CouldNotCreateInvoker(
|
||||
actionDescriptor.DisplayName));
|
||||
|
||||
// Add tracing/logging (what do we think of this pattern of
|
||||
// Add tracing/logging (what do we think of this pattern of
|
||||
// tacking on extra data on the exception?)
|
||||
ex.Data.Add("AD", actionDescriptor);
|
||||
throw ex;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Microsoft.AspNet.Mvc.OptionDescriptors
|
|||
/// </summary>
|
||||
/// <param name="options">An accessor to the <see cref="MvcOptions"/> configured for this application.</param>
|
||||
/// <param name="typeActivator">An <see cref="ITypeActivator"/> instance used to instantiate types.</param>
|
||||
/// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
|
||||
/// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
|
||||
/// service collection.</param>
|
||||
public DefaultModelBindersProvider(
|
||||
IOptions<MvcOptions> optionsAccessor,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace Microsoft.AspNet.Mvc.OptionDescriptors
|
|||
/// </summary>
|
||||
/// <param name="options">An accessor to the <see cref="MvcOptions"/> configured for this application.</param>
|
||||
/// <param name="typeActivator">An <see cref="ITypeActivator"/> instance used to instantiate types.</param>
|
||||
/// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
|
||||
/// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
|
||||
/// service collection.</param>
|
||||
public DefaultModelValidatorProviderProvider(
|
||||
IOptions<MvcOptions> optionsAccessor,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ using Microsoft.Framework.OptionsModel;
|
|||
namespace Microsoft.AspNet.Mvc.OptionDescriptors
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class DefaultValueProviderFactoryProvider :
|
||||
public class DefaultValueProviderFactoryProvider :
|
||||
OptionDescriptorBasedProvider<IValueProviderFactory>, IValueProviderFactoryProvider
|
||||
{
|
||||
/// <summary>
|
||||
|
|
@ -18,7 +18,7 @@ namespace Microsoft.AspNet.Mvc.OptionDescriptors
|
|||
/// </summary>
|
||||
/// <param name="options">An accessor to the <see cref="MvcOptions"/> configured for this application.</param>
|
||||
/// <param name="typeActivator">An <see cref="ITypeActivator"/> instance used to instantiate types.</param>
|
||||
/// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
|
||||
/// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
|
||||
/// service collection.</param>
|
||||
public DefaultValueProviderFactoryProvider(
|
||||
IOptions<MvcOptions> optionsAccessor,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Microsoft.AspNet.Mvc.OptionDescriptors
|
|||
/// </summary>
|
||||
/// <param name="options">An accessor to the <see cref="MvcOptions"/> configured for this application.</param>
|
||||
/// <param name="typeActivator">An <see cref="ITypeActivator"/> instance used to instantiate types.</param>
|
||||
/// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
|
||||
/// <param name="serviceProvider">A <see cref="IServiceProvider"/> instance that retrieves services from the
|
||||
/// service collection.</param>
|
||||
public DefaultViewEngineProvider(
|
||||
IOptions<MvcOptions> optionsAccessor,
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// the specified <paramref name="index"/>.
|
||||
/// </summary>
|
||||
/// <param name="descriptors">A list of <see cref="ModelValidatorProviderDescriptor"/>.</param>
|
||||
/// <param name="index">The zero-based index at which <paramref name="modelValidatorProviderType"/>
|
||||
/// <param name="index">The zero-based index at which <paramref name="modelValidatorProviderType"/>
|
||||
/// should be inserted.</param>
|
||||
/// <param name="modelValidatorProviderType">Type representing an <see cref="IModelValidatorProvider"/></param>
|
||||
/// <returns>A <see cref="ModelValidatorProviderDescriptor"/> representing the inserted instance.</returns>
|
||||
|
|
@ -72,7 +72,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// <paramref name="index"/>.
|
||||
/// </summary>
|
||||
/// <param name="descriptors">A list of <see cref="ModelValidatorProviderDescriptor"/>.</param>
|
||||
/// <param name="index">The zero-based index at which <paramref name="modelValidatorProvider"/>
|
||||
/// <param name="index">The zero-based index at which <paramref name="modelValidatorProvider"/>
|
||||
/// should be inserted.</param>
|
||||
/// <param name="modelValidatorProvider">An <see cref="IModelBinder"/> instance.</param>
|
||||
/// <returns>A <see cref="ModelValidatorProviderDescriptor"/> representing the added instance.</returns>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using Microsoft.Framework.DependencyInjection;
|
|||
namespace Microsoft.AspNet.Mvc.OptionDescriptors
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a default implementation for instantiating options from a sequence of
|
||||
/// Provides a default implementation for instantiating options from a sequence of
|
||||
/// <see cref="OptionDescriptor{TOption}"/>.
|
||||
/// </summary>
|
||||
/// <typeparam name="TOption">The type of the option.</typeparam>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace Microsoft.AspNet.Mvc.OptionDescriptors
|
|||
/// <summary>
|
||||
/// Creates a new instance of <see cref="ValueProviderFactoryDescriptor"/> using the specified type.
|
||||
/// </summary>
|
||||
/// <param name="valueProviderFactory">An instance of <see cref="IValueProviderFactory"/>
|
||||
/// <param name="valueProviderFactory">An instance of <see cref="IValueProviderFactory"/>
|
||||
/// that the descriptor represents.</param>
|
||||
public ValueProviderFactoryDescriptor([NotNull] IValueProviderFactory valueProviderFactory)
|
||||
: base(valueProviderFactory)
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@ namespace Microsoft.AspNet.Mvc
|
|||
public static class ModelBindingHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Updates the specified model instance using the specified binder and value provider and
|
||||
/// Updates the specified model instance using the specified binder and value provider and
|
||||
/// executes validation using the specified sequence of validator providers.
|
||||
/// </summary>
|
||||
/// <typeparam name="TModel">The type of the model object.</typeparam>
|
||||
/// <param name="model">The model instance to update.</param>
|
||||
/// <param name="prefix">The prefix to use when looking up values in the value provider.</param>
|
||||
/// <param name="httpContext">The context for the current executing request.</param>
|
||||
/// <param name="modelState">The ModelStateDictionary used for maintaining state and
|
||||
/// <param name="modelState">The ModelStateDictionary used for maintaining state and
|
||||
/// results of model-binding validation.</param>
|
||||
/// <param name="metadataProvider">The provider used for reading metadata for the model type.</param>
|
||||
/// <param name="modelBinder">The model binder used for binding.</param>
|
||||
|
|
|
|||
|
|
@ -126,10 +126,10 @@ namespace Microsoft.AspNet.Mvc.Rendering.Expressions
|
|||
}
|
||||
}
|
||||
|
||||
return GetMetadataFromProvider(modelAccessor,
|
||||
modelType ?? typeof(string),
|
||||
propertyName,
|
||||
container,
|
||||
return GetMetadataFromProvider(modelAccessor,
|
||||
modelType ?? typeof(string),
|
||||
propertyName,
|
||||
container,
|
||||
containerType,
|
||||
metadataProvider);
|
||||
}
|
||||
|
|
@ -156,11 +156,11 @@ namespace Microsoft.AspNet.Mvc.Rendering.Expressions
|
|||
|
||||
// An IModelMetadataProvider is not required unless this method is called. Therefore other methods in this
|
||||
// class lack [NotNull] attributes for their corresponding parameter.
|
||||
private static ModelMetadata GetMetadataFromProvider(Func<object> modelAccessor,
|
||||
private static ModelMetadata GetMetadataFromProvider(Func<object> modelAccessor,
|
||||
Type modelType,
|
||||
string propertyName,
|
||||
object container,
|
||||
Type containerType,
|
||||
string propertyName,
|
||||
object container,
|
||||
Type containerType,
|
||||
[NotNull] IModelMetadataProvider metadataProvider)
|
||||
{
|
||||
if (containerType != null && !string.IsNullOrEmpty(propertyName))
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
foreach (var attribute in Attributes)
|
||||
{
|
||||
var key = attribute.Key;
|
||||
if (string.Equals(key, "id", StringComparison.OrdinalIgnoreCase) &&
|
||||
if (string.Equals(key, "id", StringComparison.OrdinalIgnoreCase) &&
|
||||
string.IsNullOrEmpty(attribute.Value))
|
||||
{
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of <see cref="IFilter"/> which are used to construct filters that
|
||||
/// Gets a list of <see cref="IFilter"/> which are used to construct filters that
|
||||
/// apply to all actions.
|
||||
/// </summary>
|
||||
public ICollection<IFilter> Filters { get; private set; }
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
if (string.IsNullOrEmpty(rule.ValidationType))
|
||||
{
|
||||
throw new ArgumentException(
|
||||
Resources.FormatUnobtrusiveJavascript_ValidationTypeCannotBeEmpty(rule.GetType().FullName),
|
||||
Resources.FormatUnobtrusiveJavascript_ValidationTypeCannotBeEmpty(rule.GetType().FullName),
|
||||
"rule");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
|
|
@ -26,36 +26,36 @@
|
|||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using Microsoft.AspNet.Mvc.Routing;
|
|||
namespace Microsoft.AspNet.Mvc
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies an attribute route on a controller.
|
||||
/// Specifies an attribute route on a controller.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
|
||||
public class RouteAttribute : Attribute, IRouteTemplateProvider
|
||||
|
|
|
|||
|
|
@ -7,16 +7,16 @@ using Microsoft.AspNet.Mvc.Core;
|
|||
namespace Microsoft.AspNet.Mvc
|
||||
{
|
||||
/// <summary>
|
||||
/// An attribute which specifies a required route value for an action or controller.
|
||||
///
|
||||
/// An attribute which specifies a required route value for an action or controller.
|
||||
///
|
||||
/// When placed on an action, the route data of a request must match the expectations of the route
|
||||
/// constraint in order for the action to be selected. See <see cref="RouteKeyHandling"/> for
|
||||
/// constraint in order for the action to be selected. See <see cref="RouteKeyHandling"/> for
|
||||
/// the expectations that must be satisfied by the route data.
|
||||
///
|
||||
///
|
||||
/// When placed on a controller, unless overridden by the action, the constraint applies to all
|
||||
/// actions defined by the controller.
|
||||
///
|
||||
///
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
|
||||
public abstract class RouteConstraintAttribute : Attribute
|
||||
|
|
@ -26,7 +26,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// </summary>
|
||||
/// <param name="routeKey">The route value key.</param>
|
||||
/// <param name="keyHandling">
|
||||
/// The <see cref="RouteKeyHandling"/> value. Must be <see cref="RouteKeyHandling.CatchAll "/>
|
||||
/// The <see cref="RouteKeyHandling"/> value. Must be <see cref="RouteKeyHandling.CatchAll "/>
|
||||
/// or <see cref="RouteKeyHandling.DenyKey"/>.
|
||||
/// </param>
|
||||
protected RouteConstraintAttribute(
|
||||
|
|
@ -47,7 +47,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="RouteConstraintAttribute"/> with
|
||||
/// Creates a new <see cref="RouteConstraintAttribute"/> with
|
||||
/// <see cref="RouteConstraintAttribute.RouteKeyHandling"/> set to <see cref="RouteKeyHandling.RequireKey"/>.
|
||||
/// </summary>
|
||||
/// <param name="routeKey">The route value key.</param>
|
||||
|
|
@ -56,8 +56,8 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// Set to true to negate this constraint on all actions that do not define a behavior for this route key.
|
||||
/// </param>
|
||||
protected RouteConstraintAttribute(
|
||||
[NotNull]string routeKey,
|
||||
[NotNull]string routeValue,
|
||||
[NotNull]string routeKey,
|
||||
[NotNull]string routeValue,
|
||||
bool blockNonAttributedActions)
|
||||
{
|
||||
RouteKey = routeKey;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
|
||||
/// <summary>
|
||||
/// Requires that the key will be in the route values, but ignore the content.
|
||||
/// Constraints with this value are considered less important than ones with
|
||||
/// Constraints with this value are considered less important than ones with
|
||||
/// <see cref="RequireKey"/>
|
||||
/// </summary>
|
||||
CatchAll,
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ namespace Microsoft.AspNet.Mvc.Routing
|
|||
Walk(results, routeValues, branch);
|
||||
}
|
||||
|
||||
// If there's a fallback node we always need to process it when we have a value. We'll prioritize
|
||||
// If there's a fallback node we always need to process it when we have a value. We'll prioritize
|
||||
// non-fallback matches later in the process.
|
||||
if (hasValue && criterion.Fallback != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ namespace Microsoft.AspNet.Mvc.Routing
|
|||
_next = next;
|
||||
|
||||
// Order all the entries by order, then precedence, and then finally by template in order to provide
|
||||
// a stable routing and link generation order for templates with same order and precedence.
|
||||
// a stable routing and link generation order for templates with same order and precedence.
|
||||
// We use ordinal comparison for the templates because we only care about them being exactly equal and
|
||||
// we don't want to make any equivalence between templates based on the culture of the machine.
|
||||
|
||||
|
|
@ -182,7 +182,7 @@ namespace Microsoft.AspNet.Mvc.Routing
|
|||
// So, we need to exclude from here any values that are 'required link values', but aren't
|
||||
// parameters in the template.
|
||||
//
|
||||
// Ex:
|
||||
// Ex:
|
||||
// template: api/Products/{action}
|
||||
// required values: { id = "5", action = "Buy", Controller = "CoolProducts" }
|
||||
//
|
||||
|
|
@ -261,7 +261,7 @@ namespace Microsoft.AspNet.Mvc.Routing
|
|||
{
|
||||
// If the required value is an 'empty' route value, then ignore ambient values.
|
||||
// This handles a case where we're generating a link to an action like:
|
||||
// { area = "", controller = "Home", action = "Index" }
|
||||
// { area = "", controller = "Home", action = "Index" }
|
||||
//
|
||||
// and the ambient values has a value for area.
|
||||
if (value != null)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Microsoft.AspNet.Mvc.Routing
|
|||
|
||||
/// <summary>
|
||||
/// Gets the order of the route associated with a given action. This property determines
|
||||
/// the order in which routes get executed. Routes with a lower order value are tried first. In case a route
|
||||
/// the order in which routes get executed. Routes with a lower order value are tried first. In case a route
|
||||
/// doesn't specify a value, it gets a default order of 0.
|
||||
/// </summary>
|
||||
public int Order { get; set; }
|
||||
|
|
|
|||
|
|
@ -113,8 +113,8 @@ namespace Microsoft.AspNet.Mvc.Routing
|
|||
var errors = new List<RouteInfo>();
|
||||
|
||||
// This keeps a cache of 'Template' objects. It's a fairly common case that multiple actions
|
||||
// will use the same route template string; thus, the `Template` object can be shared.
|
||||
//
|
||||
// will use the same route template string; thus, the `Template` object can be shared.
|
||||
//
|
||||
// For a relatively simple route template, the `Template` object will hold about 500 bytes
|
||||
// of memory, so sharing is worthwhile.
|
||||
var templateCache = new Dictionary<string, RouteTemplate>(StringComparer.OrdinalIgnoreCase);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
namespace Microsoft.AspNet.Mvc.Routing
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores an <see cref="ActionSelectionDecisionTree"/> for the current value of
|
||||
/// Stores an <see cref="ActionSelectionDecisionTree"/> for the current value of
|
||||
/// <see cref="IActionDescriptorsCollectionProvider.ActionDescriptors"/>.
|
||||
/// </summary>
|
||||
public interface IActionSelectorDecisionTreeProvider
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ namespace Microsoft.AspNet.Mvc.Routing
|
|||
/// they were route value strings.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Values that are are not strings are converted to strings using
|
||||
/// Values that are are not strings are converted to strings using
|
||||
/// <c>Convert.ToString(x, CultureInfo.InvariantCulture)</c>. <c>null</c> values are converted
|
||||
/// to the empty string.
|
||||
///
|
||||
///
|
||||
/// strings are compared using <see cref="StringComparison.OrdinalIgnoreCase"/>.
|
||||
/// </remarks>
|
||||
public class RouteValueEqualityComparer : IEqualityComparer<object>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ using Microsoft.Framework.DependencyInjection;
|
|||
namespace Microsoft.AspNet.Mvc
|
||||
{
|
||||
/// <summary>
|
||||
/// An implementation of <see cref="IUrlHelper"/> that contains methods to
|
||||
/// An implementation of <see cref="IUrlHelper"/> that contains methods to
|
||||
/// build URLs for ASP.NET MVC within an application.
|
||||
/// </summary>
|
||||
public class UrlHelper : IUrlHelper
|
||||
|
|
@ -101,7 +101,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates the absolute path of the url for the specified route values by
|
||||
/// Generates the absolute path of the url for the specified route values by
|
||||
/// using the specified route name.
|
||||
/// </summary>
|
||||
/// <param name="routeName">The name of the route that is used to generate the URL.</param>
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue