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