Remove obsolete DefaultHtmlGenerator ctor (#5711)

This commit is contained in:
Jass Bagga 2017-01-25 16:25:12 -08:00 committed by GitHub
parent 42ae78a360
commit 9b1271ba19
6 changed files with 10 additions and 53 deletions

View File

@ -11,10 +11,8 @@ using System.Reflection;
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Antiforgery; using Microsoft.AspNetCore.Antiforgery;
using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Internal; using Microsoft.AspNetCore.Mvc.ModelBinding.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal; using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
@ -38,45 +36,6 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
private readonly HtmlEncoder _htmlEncoder; private readonly HtmlEncoder _htmlEncoder;
private readonly ValidationHtmlAttributeProvider _validationAttributeProvider; private readonly ValidationHtmlAttributeProvider _validationAttributeProvider;
/// <summary>
/// <para>
/// Initializes a new instance of the <see cref="DefaultHtmlGenerator"/> class.
/// </para>
/// <para>
/// This constructor is obsolete and will be removed in a future version. The recommended alternative is to
/// use <see cref="DefaultHtmlGenerator(IAntiforgery, IOptions{MvcViewOptions}, IModelMetadataProvider,
/// IUrlHelperFactory, HtmlEncoder, ClientValidatorCache, ValidationHtmlAttributeProvider)"/>.
/// </para>
/// </summary>
/// <param name="antiforgery">The <see cref="IAntiforgery"/> instance which is used to generate antiforgery
/// tokens.</param>
/// <param name="optionsAccessor">The accessor for <see cref="MvcViewOptions"/>.</param>
/// <param name="metadataProvider">The <see cref="IModelMetadataProvider"/>.</param>
/// <param name="urlHelperFactory">The <see cref="IUrlHelperFactory"/>.</param>
/// <param name="htmlEncoder">The <see cref="HtmlEncoder"/>.</param>
/// <param name="clientValidatorCache">
/// The <see cref="ClientValidatorCache"/> that provides a list of <see cref="IClientModelValidator"/>s.
/// </param>
[Obsolete("This constructor is obsolete and will be removed in a future version. The recommended " +
"alternative is to use the other public constructor.")]
public DefaultHtmlGenerator(
IAntiforgery antiforgery,
IOptions<MvcViewOptions> optionsAccessor,
IModelMetadataProvider metadataProvider,
IUrlHelperFactory urlHelperFactory,
HtmlEncoder htmlEncoder,
ClientValidatorCache clientValidatorCache)
: this(
antiforgery,
optionsAccessor,
metadataProvider,
urlHelperFactory,
htmlEncoder,
clientValidatorCache,
new DefaultValidationHtmlAttributeProvider(optionsAccessor, metadataProvider, clientValidatorCache))
{
}
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="DefaultHtmlGenerator"/> class. /// Initializes a new instance of the <see cref="DefaultHtmlGenerator"/> class.
/// </summary> /// </summary>
@ -86,9 +45,6 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
/// <param name="metadataProvider">The <see cref="IModelMetadataProvider"/>.</param> /// <param name="metadataProvider">The <see cref="IModelMetadataProvider"/>.</param>
/// <param name="urlHelperFactory">The <see cref="IUrlHelperFactory"/>.</param> /// <param name="urlHelperFactory">The <see cref="IUrlHelperFactory"/>.</param>
/// <param name="htmlEncoder">The <see cref="HtmlEncoder"/>.</param> /// <param name="htmlEncoder">The <see cref="HtmlEncoder"/>.</param>
/// <param name="clientValidatorCache">
/// The <see cref="ClientValidatorCache"/> that provides a list of <see cref="IClientModelValidator"/>s.
/// </param>
/// <param name="validationAttributeProvider">The <see cref="ValidationHtmlAttributeProvider"/>.</param> /// <param name="validationAttributeProvider">The <see cref="ValidationHtmlAttributeProvider"/>.</param>
public DefaultHtmlGenerator( public DefaultHtmlGenerator(
IAntiforgery antiforgery, IAntiforgery antiforgery,
@ -96,7 +52,6 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
IModelMetadataProvider metadataProvider, IModelMetadataProvider metadataProvider,
IUrlHelperFactory urlHelperFactory, IUrlHelperFactory urlHelperFactory,
HtmlEncoder htmlEncoder, HtmlEncoder htmlEncoder,
ClientValidatorCache clientValidatorCache,
ValidationHtmlAttributeProvider validationAttributeProvider) ValidationHtmlAttributeProvider validationAttributeProvider)
{ {
if (antiforgery == null) if (antiforgery == null)
@ -124,11 +79,6 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
throw new ArgumentNullException(nameof(htmlEncoder)); throw new ArgumentNullException(nameof(htmlEncoder));
} }
if (clientValidatorCache == null)
{
throw new ArgumentNullException(nameof(clientValidatorCache));
}
if (validationAttributeProvider == null) if (validationAttributeProvider == null)
{ {
throw new ArgumentNullException(nameof(validationAttributeProvider)); throw new ArgumentNullException(nameof(validationAttributeProvider));

View File

@ -8,5 +8,10 @@
"OldTypeId": "public class Microsoft.AspNetCore.Mvc.ViewComponentResult : Microsoft.AspNetCore.Mvc.ActionResult", "OldTypeId": "public class Microsoft.AspNetCore.Mvc.ViewComponentResult : Microsoft.AspNetCore.Mvc.ActionResult",
"OldMemberId": "public System.Void set_ViewEngine(Microsoft.AspNetCore.Mvc.ViewEngines.IViewEngine value)", "OldMemberId": "public System.Void set_ViewEngine(Microsoft.AspNetCore.Mvc.ViewEngines.IViewEngine value)",
"Kind": "Removal" "Kind": "Removal"
},
{
"OldTypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.DefaultHtmlGenerator : Microsoft.AspNetCore.Mvc.ViewFeatures.IHtmlGenerator",
"OldMemberId": "public .ctor(Microsoft.AspNetCore.Antiforgery.IAntiforgery antiforgery, Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Mvc.MvcViewOptions> optionsAccessor, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Microsoft.AspNetCore.Mvc.Routing.IUrlHelperFactory urlHelperFactory, System.Text.Encodings.Web.HtmlEncoder htmlEncoder, Microsoft.AspNetCore.Mvc.Internal.ClientValidatorCache clientValidatorCache)",
"Kind":"Removal"
} }
] ]

View File

@ -8,5 +8,10 @@
"OldTypeId": "public class Microsoft.AspNetCore.Mvc.ViewComponentResult : Microsoft.AspNetCore.Mvc.ActionResult", "OldTypeId": "public class Microsoft.AspNetCore.Mvc.ViewComponentResult : Microsoft.AspNetCore.Mvc.ActionResult",
"OldMemberId": "public System.Void set_ViewEngine(Microsoft.AspNetCore.Mvc.ViewEngines.IViewEngine value)", "OldMemberId": "public System.Void set_ViewEngine(Microsoft.AspNetCore.Mvc.ViewEngines.IViewEngine value)",
"Kind": "Removal" "Kind": "Removal"
},
{
"OldTypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.DefaultHtmlGenerator : Microsoft.AspNetCore.Mvc.ViewFeatures.IHtmlGenerator",
"OldMemberId": "public .ctor(Microsoft.AspNetCore.Antiforgery.IAntiforgery antiforgery, Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Mvc.MvcViewOptions> optionsAccessor, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Microsoft.AspNetCore.Mvc.Routing.IUrlHelperFactory urlHelperFactory, System.Text.Encodings.Web.HtmlEncoder htmlEncoder, Microsoft.AspNetCore.Mvc.Internal.ClientValidatorCache clientValidatorCache)",
"Kind":"Removal"
} }
] ]

View File

@ -50,7 +50,6 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
metadataProvider, metadataProvider,
CreateUrlHelperFactory(urlHelper), CreateUrlHelperFactory(urlHelper),
new HtmlTestEncoder(), new HtmlTestEncoder(),
new ClientValidatorCache(),
new DefaultValidationHtmlAttributeProvider(options, metadataProvider, new ClientValidatorCache())) new DefaultValidationHtmlAttributeProvider(options, metadataProvider, new ClientValidatorCache()))
{ {
_validationAttributes = validationAttributes; _validationAttributes = validationAttributes;

View File

@ -263,7 +263,6 @@ namespace Microsoft.AspNetCore.Mvc.Rendering
provider, provider,
urlHelperFactory.Object, urlHelperFactory.Object,
new HtmlTestEncoder(), new HtmlTestEncoder(),
new ClientValidatorCache(),
attributeProvider); attributeProvider);
} }

View File

@ -702,7 +702,6 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
metadataProvider, metadataProvider,
new UrlHelperFactory(), new UrlHelperFactory(),
htmlEncoder, htmlEncoder,
new ClientValidatorCache(),
attributeProvider); attributeProvider);
} }