Small code cleanup (#5388)

* Removed unused private GetUrlHelper method in LocalRedirectResult class.

* Minor code formatting improvements.

* Fixed white space and casing of 'URL' in comment in RedirectResultExecutor.
This commit is contained in:
Vladislav Karamfilov 2016-10-18 06:45:47 +03:00 committed by Ajay Bhargav Baaskaran
parent eea297975d
commit 3ef7d01bb6
5 changed files with 5 additions and 18 deletions

View File

@ -203,7 +203,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
if (object.ReferenceEquals(s1, null))
{
return object.ReferenceEquals(s2, null); ;
return object.ReferenceEquals(s2, null);
}
return s1.Equals(s2);

View File

@ -120,7 +120,7 @@ namespace Microsoft.Extensions.DependencyInjection
builder.PartManager.PopulateFeature(feature);
foreach (var controller in feature.Controllers.Select(c => c.AsType()))
{
{
builder.Services.TryAddTransient(controller, controller);
}

View File

@ -32,7 +32,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
{
var urlHelper = result.UrlHelper ?? _urlHelperFactory.GetUrlHelper(context);
// IsLocalUrl is called to handle Urls starting with '~/'.
// IsLocalUrl is called to handle URLs starting with '~/'.
var destinationUrl = result.Url;
if (urlHelper.IsLocalUrl(destinationUrl))
{

View File

@ -4,7 +4,6 @@
using System;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc
@ -84,17 +83,5 @@ namespace Microsoft.AspNetCore.Mvc
var executor = context.HttpContext.RequestServices.GetRequiredService<LocalRedirectResultExecutor>();
executor.Execute(context, this);
}
private IUrlHelper GetUrlHelper(ActionContext context)
{
var urlHelper = UrlHelper;
if (urlHelper == null)
{
var services = context.HttpContext.RequestServices;
urlHelper = services.GetRequiredService<IUrlHelperFactory>().GetUrlHelper(context);
}
return urlHelper;
}
}
}

View File

@ -34,8 +34,8 @@ namespace Microsoft.AspNetCore.Mvc
public override Task ExecuteResultAsync(ActionContext context)
{
var executor = context.HttpContext.RequestServices.GetRequiredService<ObjectResultExecutor>();
var result = executor.ExecuteAsync(context, this);
var result = executor.ExecuteAsync(context, this);
return result;
}