Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Make types in Microsoft.AspNetCore.Mvc.ViewFeatures internal #8705

Merged
merged 1 commit into from
Nov 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
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;

Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.AspNetCore.Mvc.Razor/RazorPageBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
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;
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.AspNetCore.Mvc.Razor/RazorView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.AspNetCore.Mvc.TagHelpers/CacheTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
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;
Expand Down
1 change: 0 additions & 1 deletion src/Microsoft.AspNetCore.Mvc.TagHelpers/InputTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
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
Expand Down
7 changes: 2 additions & 5 deletions src/Microsoft.AspNetCore.Mvc.TagHelpers/PartialTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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
Expand All @@ -34,10 +34,7 @@ public class PartialTagHelper : TagHelper

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));
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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();

Expand Down
Original file line number Diff line number Diff line change
@@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using System.Text;
using System.Threading.Tasks;

namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
public class PagedBufferedTextWriter : TextWriter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could IViewBufferScope.CreateWriter(...) return a TextWriter? That should allow this type to be internal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that seems like a reasonable design. Added it as a note to the API review issue

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Html;

namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Internal
namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers
{
/// <summary>
/// <para>
Expand All @@ -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;
Expand Down Expand Up @@ -161,15 +161,13 @@ public override void Write(object value)
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
{
Expand Down Expand Up @@ -227,16 +225,14 @@ public override void WriteLine(object value)
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
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.
Expand Down
1 change: 0 additions & 1 deletion src/Microsoft.AspNetCore.Mvc.ViewFeatures/Controller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
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";
Expand Down
Loading