Make types in Microsoft.AspNetCore.Mvc.ViewFeatures internal

This commit is contained in:
Pranav K 2018-11-08 11:32:40 -08:00
parent be220e8bc2
commit b18526cdc8
190 changed files with 216 additions and 237 deletions

View File

@ -8,7 +8,6 @@ using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Internal;

View File

@ -16,7 +16,7 @@ using Microsoft.AspNetCore.Mvc.Razor.Internal;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
using Microsoft.AspNetCore.Razor.Runtime.TagHelpers;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.DependencyInjection;

View File

@ -7,10 +7,10 @@ using System.Diagnostics;
using System.Linq;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Razor.Internal;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Mvc.Razor.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc.Razor

View File

@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
{

View File

@ -15,7 +15,6 @@ using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;

View File

@ -9,12 +9,10 @@ using System.Linq;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

View File

@ -3,7 +3,7 @@
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
namespace Microsoft.AspNetCore.Mvc.RazorPages
{

View File

@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc.RazorPages

View File

@ -4,7 +4,7 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
namespace Microsoft.AspNetCore.Mvc.RazorPages
{

View File

@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
namespace Microsoft.AspNetCore.Mvc.RazorPages
{

View File

@ -3,7 +3,7 @@
using System;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.RazorPages

View File

@ -3,8 +3,7 @@
using System;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.RazorPages.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
namespace Microsoft.AspNetCore.Mvc.RazorPages
{

View File

@ -11,7 +11,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.TagHelpers.Cache;
using Microsoft.AspNetCore.Mvc.TagHelpers.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Primitives;

View File

@ -7,7 +7,6 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Razor.TagHelpers;
namespace Microsoft.AspNetCore.Mvc.TagHelpers

View File

@ -9,7 +9,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
using Microsoft.AspNetCore.Razor.TagHelpers;
namespace Microsoft.AspNetCore.Mvc.TagHelpers
@ -34,10 +34,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
public PartialTagHelper(
ICompositeViewEngine viewEngine,
#pragma warning disable PUB0001 // Pubternal type in public API
IViewBufferScope viewBufferScope
#pragma warning restore PUB0001
)
IViewBufferScope viewBufferScope)
{
_viewEngine = viewEngine ?? throw new ArgumentNullException(nameof(viewEngine));
_viewBufferScope = viewBufferScope ?? throw new ArgumentNullException(nameof(viewBufferScope));

View File

@ -0,0 +1,7 @@
[
{
"TypeId": "public class Microsoft.AspNetCore.Mvc.TagHelpers.PartialTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper",
"MemberId": "public .ctor(Microsoft.AspNetCore.Mvc.ViewEngines.ICompositeViewEngine viewEngine, Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.IViewBufferScope viewBufferScope)",
"Kind": "Removal"
}
]

View File

@ -3,7 +3,7 @@
using System;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc

View File

@ -3,9 +3,9 @@
using System.Buffers;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
public class ArrayPoolBufferSource : ICharBufferSource
internal class ArrayPoolBufferSource : ICharBufferSource
{
private readonly ArrayPool<char> _pool;

View File

@ -1,9 +1,9 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
public class CharArrayBufferSource : ICharBufferSource
internal class CharArrayBufferSource : ICharBufferSource
{
public static readonly CharArrayBufferSource Instance = new CharArrayBufferSource();

View File

@ -1,9 +1,9 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
public interface ICharBufferSource
internal interface ICharBufferSource
{
char[] Rent(int bufferSize);

View File

@ -3,7 +3,7 @@
using System.IO;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
/// <summary>
/// Creates and manages the lifetime of <see cref="T:ViewBufferValue[]"/> instances.

View File

@ -6,12 +6,12 @@ using System.Buffers;
using System.Collections.Generic;
using System.IO;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
/// <summary>
/// A <see cref="IViewBufferScope"/> that uses pooled memory.
/// </summary>
public class MemoryPoolViewBufferScope : IViewBufferScope, IDisposable
internal class MemoryPoolViewBufferScope : IViewBufferScope, IDisposable
{
public static readonly int MinimumSize = 16;
private readonly ArrayPool<ViewBufferValue> _viewBufferPool;

View File

@ -9,7 +9,7 @@ using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
public class PagedBufferedTextWriter : TextWriter
{

View File

@ -5,9 +5,9 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
public class PagedCharBuffer : IDisposable
internal class PagedCharBuffer : IDisposable
{
public const int PageSize = 1024;
private int _charIndex;

View File

@ -10,13 +10,13 @@ using System.Text.Encodings.Web;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Html;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
/// <summary>
/// An <see cref="IHtmlContentBuilder"/> that is backed by a buffer provided by <see cref="IViewBufferScope"/>.
/// </summary>
[DebuggerDisplay("{DebuggerToString()}")]
public class ViewBuffer : IHtmlContentBuilder
internal class ViewBuffer : IHtmlContentBuilder
{
public static readonly int PartialViewPageSize = 32;
public static readonly int TagHelperPageSize = 32;

View File

@ -3,9 +3,9 @@
using System.Runtime.CompilerServices;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
public class ViewBufferPage
internal class ViewBufferPage
{
public ViewBufferPage(ViewBufferValue[] buffer)
{

View File

@ -8,7 +8,7 @@ using System.Text.Encodings.Web;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Html;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
/// <summary>
/// <para>
@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
/// the writer and switches to writing to the unbuffered writer for all further write operations.
/// </para>
/// </summary>
public class ViewBufferTextWriter : TextWriter
internal class ViewBufferTextWriter : TextWriter
{
private readonly TextWriter _inner;
private readonly HtmlEncoder _htmlEncoder;
@ -161,15 +161,13 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
return;
}
IHtmlContentContainer container;
IHtmlContent content;
if ((container = value as IHtmlContentContainer) != null)
if (value is IHtmlContentContainer container)
{
Write(container);
}
else if ((content = value as IHtmlContent) != null)
else if (value is IHtmlContent htmlContent)
{
Write(content);
Write(htmlContent);
}
else
{
@ -227,16 +225,14 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
return;
}
IHtmlContentContainer container;
IHtmlContent content;
if ((container = value as IHtmlContentContainer) != null)
if (value is IHtmlContentContainer container)
{
Write(container);
Write(NewLine);
}
else if ((content = value as IHtmlContent) != null)
else if (value is IHtmlContent htmlContent)
{
Write(content);
Write(htmlContent);
Write(NewLine);
}
else

View File

@ -6,7 +6,7 @@ using System.IO;
using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Html;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
/// <summary>
/// Encapsulates a string or <see cref="IHtmlContent"/> value.

View File

@ -6,7 +6,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;

View File

@ -5,11 +5,11 @@ using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.AspNetCore.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.Extensions.Options;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{

View File

@ -10,11 +10,12 @@ using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
public static class DefaultDisplayTemplates
internal static class DefaultDisplayTemplates
{
public static IHtmlContent BooleanTemplate(IHtmlHelper htmlHelper)
{

View File

@ -13,11 +13,12 @@ using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
public static class DefaultEditorTemplates
internal static class DefaultEditorTemplates
{
private const string HtmlAttributeKey = "htmlAttributes";
private const string UsePasswordValue = "Switch.Microsoft.AspNetCore.Mvc.UsePasswordValue";

View File

@ -15,7 +15,6 @@ using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures

View File

@ -29,8 +29,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
public DefaultValidationHtmlAttributeProvider(
IOptions<MvcViewOptions> optionsAccessor,
IModelMetadataProvider metadataProvider,
ClientValidatorCache clientValidatorCache
)
ClientValidatorCache clientValidatorCache)
{
if (optionsAccessor == null)
{

View File

@ -14,7 +14,8 @@ using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewComponents;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;

View File

@ -2,17 +2,18 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.DataAnnotations;
using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
/// Sets up default options for <see cref="MvcViewOptions"/>.
/// </summary>
public class MvcViewOptionsSetup : IConfigureOptions<MvcViewOptions>
internal class MvcViewOptionsSetup : IConfigureOptions<MvcViewOptions>
{
private readonly IOptions<MvcDataAnnotationsLocalizationOptions> _dataAnnotationsLocalizationOptions;
private readonly IValidationAttributeAdapterProvider _validationAttributeAdapterProvider;

View File

@ -1,14 +1,16 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
/// Sets up default options for <see cref="MvcOptions"/>.
/// </summary>
public class TempDataMvcOptionsSetup : IConfigureOptions<MvcOptions>
internal class TempDataMvcOptionsSetup : IConfigureOptions<MvcOptions>
{
public void Configure(MvcOptions options)
{

View File

@ -5,9 +5,9 @@ using System;
using System.Collections.Generic;
using System.Dynamic;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
public class DynamicViewData : DynamicObject
internal class DynamicViewData : DynamicObject
{
private readonly Func<ViewDataDictionary> _viewDataFunc;

View File

@ -9,9 +9,9 @@ using System.Linq.Expressions;
using System.Reflection;
using System.Text;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
public static class ExpressionHelper
internal static class ExpressionHelper
{
public static string GetExpressionText(string expression)
{

View File

@ -8,9 +8,9 @@ using System.Linq.Expressions;
using System.Reflection;
using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
public static class ExpressionMetadataProvider
internal static class ExpressionMetadataProvider
{
public static ModelExplorer FromLambdaExpression<TModel, TResult>(
Expression<Func<TModel, TResult>> expression,

View File

@ -7,7 +7,7 @@ using System.Collections.Generic;
using System.Linq.Expressions;
using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
/// <summary>
/// This class holds the cache for the expression text that is computed by ExpressionHelper.

View File

@ -6,9 +6,9 @@ using Microsoft.AspNetCore.Antiforgery;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
public class AutoValidateAntiforgeryTokenAuthorizationFilter : ValidateAntiforgeryTokenAuthorizationFilter
internal class AutoValidateAntiforgeryTokenAuthorizationFilter : ValidateAntiforgeryTokenAuthorizationFilter
{
public AutoValidateAntiforgeryTokenAuthorizationFilter(IAntiforgery antiforgery, ILoggerFactory loggerFactory)
: base(antiforgery, loggerFactory)

View File

@ -2,9 +2,8 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
internal class ControllerSaveTempDataPropertyFilter : SaveTempDataPropertyFilterBase, IActionFilter
{

View File

@ -4,10 +4,9 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
internal class ControllerSaveTempDataPropertyFilterFactory : IFilterFactory
{

View File

@ -3,9 +3,8 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
internal class ControllerViewDataAttributeFilter : IActionFilter, IViewDataValuesProviderFeature
{

View File

@ -4,9 +4,8 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
internal class ControllerViewDataAttributeFilterFactory : IFilterFactory
{

View File

@ -3,9 +3,9 @@
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
public interface ISaveTempDataCallback : IFilterMetadata
internal interface ISaveTempDataCallback : IFilterMetadata
{
void OnTempDataSaving(ITempDataDictionary tempData);
}

View File

@ -1,9 +1,9 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
public interface IViewDataValuesProviderFeature
internal interface IViewDataValuesProviderFeature
{
void ProvideViewDataValues(ViewDataDictionary viewData);
}

View File

@ -6,10 +6,10 @@ using System.Diagnostics;
using System.Reflection;
using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
[DebuggerDisplay("{PropertyInfo, nq}")]
public readonly struct LifecycleProperty
internal readonly struct LifecycleProperty
{
private readonly PropertyHelper _propertyHelper;
private readonly bool _isReferenceTypeOrNullable;

View File

@ -7,12 +7,12 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
/// <summary>
/// A filter that saves temp data.
/// </summary>
public class SaveTempDataFilter : IResourceFilter, IResultFilter
internal class SaveTempDataFilter : IResourceFilter, IResultFilter
{
// Internal for unit testing
internal static readonly object SaveTempDataFilterContextKey = new object();

View File

@ -7,9 +7,9 @@ using System.Diagnostics;
using System.Reflection;
using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
public abstract class SaveTempDataPropertyFilterBase : ISaveTempDataCallback
internal abstract class SaveTempDataPropertyFilterBase : ISaveTempDataCallback
{
protected readonly ITempDataDictionaryFactory _tempDataFactory;

View File

@ -3,10 +3,9 @@
using System;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
internal class TempDataApplicationModelProvider : IApplicationModelProvider
{

View File

@ -14,9 +14,9 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Bson;
using Newtonsoft.Json.Linq;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
public class TempDataSerializer
internal class TempDataSerializer
{
private readonly JsonSerializer _jsonSerializer =
JsonSerializer.Create(JsonSerializerSettingsProvider.CreateSerializerSettings());
@ -62,9 +62,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
StringComparer.OrdinalIgnoreCase);
foreach (var item in tempDataDictionary)
{
var jArrayValue = item.Value as JArray;
var jObjectValue = item.Value as JObject;
if (jArrayValue != null && jArrayValue.Count > 0)
if (item.Value is JArray jArrayValue && jArrayValue.Count > 0)
{
var arrayType = jArrayValue[0].Type;
if (_tokenTypeLookup.TryGetValue(arrayType, out var returnType))
@ -85,7 +83,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
throw new InvalidOperationException(message);
}
}
else if (jObjectValue != null)
else if (item.Value is JObject jObjectValue)
{
if (!jObjectValue.HasValues)
{

View File

@ -7,9 +7,9 @@ using Microsoft.AspNetCore.Antiforgery;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
public class ValidateAntiforgeryTokenAuthorizationFilter : IAsyncAuthorizationFilter, IAntiforgeryPolicy
internal class ValidateAntiforgeryTokenAuthorizationFilter : IAsyncAuthorizationFilter, IAntiforgeryPolicy
{
private readonly IAntiforgery _antiforgery;
private readonly ILogger _logger;

View File

@ -3,9 +3,8 @@
using System;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
internal class ViewDataAttributeApplicationModelProvider : IApplicationModelProvider
{

View File

@ -6,9 +6,9 @@ using System.Collections.Generic;
using System.Reflection;
using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Filters
{
public static class ViewDataAttributePropertyProvider
internal static class ViewDataAttributePropertyProvider
{
public static IReadOnlyList<LifecycleProperty> GetViewDataProperties(Type type)
{

View File

@ -5,9 +5,9 @@ using System;
using System.Globalization;
using System.Threading;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
public class FormatWeekHelper
internal static class FormatWeekHelper
{
public static string GetFormattedWeek(ModelExplorer modelExplorer)
{

View File

@ -6,7 +6,7 @@ using System.Collections.Concurrent;
using System.Reflection;
using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
internal class HtmlAttributePropertyHelper : PropertyHelper
{

View File

@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
@ -43,9 +43,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
IHtmlGenerator htmlGenerator,
ICompositeViewEngine viewEngine,
IModelMetadataProvider metadataProvider,
#pragma warning disable PUB0001 // Pubternal type in public API
IViewBufferScope bufferScope,
#pragma warning restore PUB0001
HtmlEncoder htmlEncoder,
UrlEncoder urlEncoder)
{

View File

@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
@ -24,15 +24,10 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
IHtmlGenerator htmlGenerator,
ICompositeViewEngine viewEngine,
IModelMetadataProvider metadataProvider,
#pragma warning disable PUB0001 // Pubternal type in public API
IViewBufferScope bufferScope,
#pragma warning restore PUB0001
HtmlEncoder htmlEncoder,
UrlEncoder urlEncoder,
#pragma warning disable PUB0001 // Pubternal type in public API
ExpressionTextCache expressionTextCache
#pragma warning restore PUB0001
)
ExpressionTextCache expressionTextCache)
: base(
htmlGenerator,
viewEngine,

View File

@ -4,7 +4,6 @@
using System;
using System.Linq.Expressions;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{

View File

@ -4,7 +4,7 @@
using System;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
namespace Microsoft.AspNetCore.Mvc.ModelBinding
{

View File

@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewComponents;
using Microsoft.AspNetCore.Mvc.ViewEngines;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
internal static class MvcViewFeaturesDiagnosticSourceExtensions
{

View File

@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Mvc.ViewComponents;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
internal static class MvcViewFeaturesLoggerExtensions
{

View File

@ -4,12 +4,12 @@
using System;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
/// <summary>
/// Provides cached values for "name" and "id" HTML attributes.
/// </summary>
public static class NameAndIdProvider
internal static class NameAndIdProvider
{
private static readonly object PreviousNameAndIdKey = typeof(PreviousNameAndId);

View File

@ -6,9 +6,9 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
public class NullView : IView
internal class NullView : IView
{
public static readonly NullView Instance = new NullView();

View File

@ -10,7 +10,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

View File

@ -3,7 +3,13 @@
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.RazorPages, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.TagHelpers, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.RazorPages.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.TagHelpers.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Views.TestCommon, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.ViewFeatures.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]

View File

@ -4,7 +4,7 @@
using System;
using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
namespace Microsoft.AspNetCore.Mvc.Rendering
{
@ -76,21 +76,20 @@ namespace Microsoft.AspNetCore.Mvc.Rendering
return;
}
var viewBufferWriter = _viewContext.Writer as ViewBufferTextWriter;
if (viewBufferWriter == null)
{
foreach (var content in formContext.EndOfFormContent)
{
content.WriteTo(_viewContext.Writer, _htmlEncoder);
}
}
else
if (_viewContext.Writer is ViewBufferTextWriter viewBufferWriter)
{
foreach (var content in formContext.EndOfFormContent)
{
viewBufferWriter.Write(content);
}
}
else
{
foreach (var content in formContext.EndOfFormContent)
{
content.WriteTo(_viewContext.Writer, _htmlEncoder);
}
}
}
}
}

View File

@ -6,7 +6,6 @@ using System.IO;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
namespace Microsoft.AspNetCore.Mvc.Rendering
{

View File

@ -3,7 +3,7 @@
using System;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures

View File

@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Filters;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
@ -33,8 +33,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
// Accessing Session property will throw if the session middleware is not enabled.
var session = context.Session;
byte[] value;
if (session.TryGetValue(TempDataSessionStateKey, out value))
if (session.TryGetValue(TempDataSessionStateKey, out var value))
{
// If we got it from Session, remove it so that no other request gets it
session.Remove(TempDataSessionStateKey);

View File

@ -8,10 +8,11 @@ using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
public class TemplateBuilder
internal class TemplateBuilder
{
private readonly IViewEngine _viewEngine;
private readonly IViewBufferScope _bufferScope;

View File

@ -11,11 +11,12 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
public class TemplateRenderer
internal class TemplateRenderer
{
private const string DisplayTemplateViewPath = "DisplayTemplates";
private const string EditorTemplateViewPath = "EditorTemplates";

Some files were not shown because too many files have changed in this diff Show More