Get rid of pubternal in routing

The only pubternal that remains is DfaGraphWriter - it's a good use case
for pubternal because it's something we want to expose, but we'd never
service and would willingly break the API in the future. It's also
really unlikly that anyone would build on top of it.
This commit is contained in:
Ryan Nowak 2019-07-01 08:22:05 -07:00
parent c96f179898
commit 1c126ab773
34 changed files with 19 additions and 141 deletions

View File

@ -497,34 +497,6 @@ namespace Microsoft.AspNetCore.Routing.Internal
public DfaGraphWriter(System.IServiceProvider services) { } public DfaGraphWriter(System.IServiceProvider services) { }
public void Write(Microsoft.AspNetCore.Routing.EndpointDataSource dataSource, System.IO.TextWriter writer) { } public void Write(Microsoft.AspNetCore.Routing.EndpointDataSource dataSource, System.IO.TextWriter writer) { }
} }
[System.ObsoleteAttribute("This type will be marked as internal in a future release.")]
public enum SegmentState
{
Beginning = 0,
Inside = 1,
}
[System.Diagnostics.DebuggerDisplayAttribute("{DebuggerToString(),nq}")]
[System.ObsoleteAttribute("This type will be marked as internal in a future release.")]
public partial class UriBuildingContext
{
public UriBuildingContext(System.Text.Encodings.Web.UrlEncoder urlEncoder) { }
public bool AppendTrailingSlash { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public Microsoft.AspNetCore.Routing.Internal.SegmentState BufferState { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public bool LowercaseQueryStrings { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public bool LowercaseUrls { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public System.IO.TextWriter PathWriter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public System.IO.TextWriter QueryWriter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Routing.Internal.SegmentState UriState { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public bool Accept(string value) { throw null; }
public bool Accept(string value, bool encodeSlashes) { throw null; }
public bool Buffer(string value) { throw null; }
public void Clear() { }
public void EndSegment() { }
public void Remove(string literal) { }
public Microsoft.AspNetCore.Http.PathString ToPathString() { throw null; }
public Microsoft.AspNetCore.Http.QueryString ToQueryString() { throw null; }
public override string ToString() { throw null; }
}
} }
namespace Microsoft.AspNetCore.Routing.Matching namespace Microsoft.AspNetCore.Routing.Matching
{ {
@ -767,10 +739,7 @@ namespace Microsoft.AspNetCore.Routing.Template
} }
public partial class TemplateBinder public partial class TemplateBinder
{ {
[System.ObsoleteAttribute("This constructor is obsolete and will be marked internal in a future release. Use the TemplateBinderFactory service to create TemplateBinder instances.")] internal TemplateBinder() { }
public TemplateBinder(System.Text.Encodings.Web.UrlEncoder urlEncoder, Microsoft.Extensions.ObjectPool.ObjectPool<Microsoft.AspNetCore.Routing.Internal.UriBuildingContext> pool, Microsoft.AspNetCore.Routing.Patterns.RoutePattern pattern, Microsoft.AspNetCore.Routing.RouteValueDictionary defaults, System.Collections.Generic.IEnumerable<string> requiredKeys, System.Collections.Generic.IEnumerable<System.ValueTuple<string, Microsoft.AspNetCore.Routing.IParameterPolicy>> parameterPolicies) { }
[System.ObsoleteAttribute("This constructor is obsolete and will be marked internal in a furture release. Use the TemplateBinderFactory service to create TemplateBinder instances.")]
public TemplateBinder(System.Text.Encodings.Web.UrlEncoder urlEncoder, Microsoft.Extensions.ObjectPool.ObjectPool<Microsoft.AspNetCore.Routing.Internal.UriBuildingContext> pool, Microsoft.AspNetCore.Routing.Template.RouteTemplate template, Microsoft.AspNetCore.Routing.RouteValueDictionary defaults) { }
public string BindValues(Microsoft.AspNetCore.Routing.RouteValueDictionary acceptedValues) { throw null; } public string BindValues(Microsoft.AspNetCore.Routing.RouteValueDictionary acceptedValues) { throw null; }
public Microsoft.AspNetCore.Routing.Template.TemplateValuesResult GetValues(Microsoft.AspNetCore.Routing.RouteValueDictionary ambientValues, Microsoft.AspNetCore.Routing.RouteValueDictionary values) { throw null; } public Microsoft.AspNetCore.Routing.Template.TemplateValuesResult GetValues(Microsoft.AspNetCore.Routing.RouteValueDictionary ambientValues, Microsoft.AspNetCore.Routing.RouteValueDictionary values) { throw null; }
public static bool RoutePartsEqual(object a, object b) { throw null; } public static bool RoutePartsEqual(object a, object b) { throw null; }
@ -868,8 +837,7 @@ namespace Microsoft.AspNetCore.Routing.Tree
} }
public partial class TreeRouteBuilder public partial class TreeRouteBuilder
{ {
[System.ObsoleteAttribute("This constructor will be marked internal in a future release. Use the service provider to create instances of TreeRouteBuilder.")] internal TreeRouteBuilder() { }
public TreeRouteBuilder(Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.Extensions.ObjectPool.ObjectPool<Microsoft.AspNetCore.Routing.Internal.UriBuildingContext> objectPool, Microsoft.AspNetCore.Routing.IInlineConstraintResolver constraintResolver) { }
public System.Collections.Generic.IList<Microsoft.AspNetCore.Routing.Tree.InboundRouteEntry> InboundEntries { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public System.Collections.Generic.IList<Microsoft.AspNetCore.Routing.Tree.InboundRouteEntry> InboundEntries { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public System.Collections.Generic.IList<Microsoft.AspNetCore.Routing.Tree.OutboundRouteEntry> OutboundEntries { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public System.Collections.Generic.IList<Microsoft.AspNetCore.Routing.Tree.OutboundRouteEntry> OutboundEntries { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Routing.Tree.TreeRouter Build() { throw null; } public Microsoft.AspNetCore.Routing.Tree.TreeRouter Build() { throw null; }
@ -880,9 +848,8 @@ namespace Microsoft.AspNetCore.Routing.Tree
} }
public partial class TreeRouter : Microsoft.AspNetCore.Routing.IRouter public partial class TreeRouter : Microsoft.AspNetCore.Routing.IRouter
{ {
internal TreeRouter() { }
public static readonly string RouteGroupKey; public static readonly string RouteGroupKey;
[System.ObsoleteAttribute("This constructor will be marked obsolete in a future release. Use the TreeRouterBuilder to create instances of TreeRouter.")]
public TreeRouter(Microsoft.AspNetCore.Routing.Tree.UrlMatchingTree[] trees, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Routing.Tree.OutboundRouteEntry> linkGenerationEntries, System.Text.Encodings.Web.UrlEncoder urlEncoder, Microsoft.Extensions.ObjectPool.ObjectPool<Microsoft.AspNetCore.Routing.Internal.UriBuildingContext> objectPool, Microsoft.Extensions.Logging.ILogger routeLogger, Microsoft.Extensions.Logging.ILogger constraintLogger, int version) { }
public int Version { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public int Version { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public Microsoft.AspNetCore.Routing.VirtualPathData GetVirtualPath(Microsoft.AspNetCore.Routing.VirtualPathContext context) { throw null; } public Microsoft.AspNetCore.Routing.VirtualPathData GetVirtualPath(Microsoft.AspNetCore.Routing.VirtualPathContext context) { throw null; }
[System.Diagnostics.DebuggerStepThroughAttribute] [System.Diagnostics.DebuggerStepThroughAttribute]

View File

@ -4,7 +4,6 @@
using System; using System;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;

View File

@ -3,7 +3,6 @@
using System; using System;
using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Builder namespace Microsoft.AspNetCore.Builder
@ -75,4 +74,4 @@ namespace Microsoft.AspNetCore.Builder
return builder.UseRouter(routeBuilder.Build()); return builder.UseRouter(routeBuilder.Build());
} }
} }
} }

View File

@ -3,7 +3,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Routing namespace Microsoft.AspNetCore.Routing

View File

@ -10,7 +10,6 @@ using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.AspNetCore.Routing.Template; using Microsoft.AspNetCore.Routing.Template;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;

View File

@ -1,9 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using Microsoft.AspNetCore.Routing.Constraints; using Microsoft.AspNetCore.Routing.Constraints;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.AspNetCore.Routing.Patterns;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;

View File

@ -35,7 +35,6 @@ namespace Microsoft.Extensions.DependencyInjection
services.TryAddTransient<IInlineConstraintResolver, DefaultInlineConstraintResolver>(); services.TryAddTransient<IInlineConstraintResolver, DefaultInlineConstraintResolver>();
services.TryAddTransient<ObjectPoolProvider, DefaultObjectPoolProvider>(); services.TryAddTransient<ObjectPoolProvider, DefaultObjectPoolProvider>();
#pragma warning disable CS0618 // Type or member is obsolete
services.TryAddSingleton<ObjectPool<UriBuildingContext>>(s => services.TryAddSingleton<ObjectPool<UriBuildingContext>>(s =>
{ {
var provider = s.GetRequiredService<ObjectPoolProvider>(); var provider = s.GetRequiredService<ObjectPoolProvider>();
@ -51,7 +50,6 @@ namespace Microsoft.Extensions.DependencyInjection
var constraintResolver = s.GetRequiredService<IInlineConstraintResolver>(); var constraintResolver = s.GetRequiredService<IInlineConstraintResolver>();
return new TreeRouteBuilder(loggerFactory, objectPool, constraintResolver); return new TreeRouteBuilder(loggerFactory, objectPool, constraintResolver);
})); }));
#pragma warning restore CS0618 // Type or member is obsolete
services.TryAddSingleton(typeof(RoutingMarkerService)); services.TryAddSingleton(typeof(RoutingMarkerService));

View File

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using Microsoft.AspNetCore.Routing.Internal;
namespace Microsoft.AspNetCore.Routing.Patterns namespace Microsoft.AspNetCore.Routing.Patterns
{ {
@ -256,4 +255,4 @@ namespace Microsoft.AspNetCore.Routing.Patterns
} }
} }
} }
} }

View File

@ -4,7 +4,6 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.AspNetCore.Routing.Patterns;
using Microsoft.Extensions.Primitives; using Microsoft.Extensions.Primitives;

View File

@ -245,7 +245,6 @@ namespace Microsoft.AspNetCore.Routing
} }
} }
#pragma warning disable CS0618 // Type or member is obsolete
private void EnsureBinder(HttpContext context) private void EnsureBinder(HttpContext context)
{ {
if (_binder == null) if (_binder == null)
@ -254,7 +253,6 @@ namespace Microsoft.AspNetCore.Routing
_binder = binderFactory.Create(ParsedTemplate, Defaults); _binder = binderFactory.Create(ParsedTemplate, Defaults);
} }
} }
#pragma warning restore CS0618 // Type or member is obsolete
private void EnsureLoggers(HttpContext context) private void EnsureLoggers(HttpContext context)
{ {

View File

@ -4,7 +4,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Routing namespace Microsoft.AspNetCore.Routing
@ -58,4 +57,4 @@ namespace Microsoft.AspNetCore.Routing
return routeCollection; return routeCollection;
} }
} }
} }

View File

@ -4,7 +4,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.AspNetCore.Routing.Constraints; using Microsoft.AspNetCore.Routing.Constraints;
using Microsoft.AspNetCore.Routing.Internal;
namespace Microsoft.AspNetCore.Routing namespace Microsoft.AspNetCore.Routing
{ {

View File

@ -4,7 +4,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.AspNetCore.Routing.Template; using Microsoft.AspNetCore.Routing.Template;
using Microsoft.AspNetCore.Routing.Tree; using Microsoft.AspNetCore.Routing.Tree;

View File

@ -1,9 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; namespace Microsoft.AspNetCore.Routing
namespace Microsoft.AspNetCore.Routing.Internal
{ {
// Segments are treated as all-or-none. We should never output a partial segment. // Segments are treated as all-or-none. We should never output a partial segment.
// If we add any subsegment of this segment to the generated URI, we have to add // If we add any subsegment of this segment to the generated URI, we have to add
@ -11,8 +9,7 @@ namespace Microsoft.AspNetCore.Routing.Internal
// used a value for {p1}, we have to output the entire segment up to the next "/". // used a value for {p1}, we have to output the entire segment up to the next "/".
// Otherwise we could end up with the partial segment "v1" instead of the entire // Otherwise we could end up with the partial segment "v1" instead of the entire
// segment "v1-v2.xml". // segment "v1-v2.xml".
[Obsolete("This type will be marked as internal in a future release.")] internal enum SegmentState
public enum SegmentState
{ {
Beginning, Beginning,
Inside, Inside,

View File

@ -4,7 +4,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.AspNetCore.Routing.Patterns;
using Microsoft.Extensions.ObjectPool; using Microsoft.Extensions.ObjectPool;
@ -13,15 +12,11 @@ namespace Microsoft.AspNetCore.Routing.Template
internal sealed class DefaultTemplateBinderFactory : TemplateBinderFactory internal sealed class DefaultTemplateBinderFactory : TemplateBinderFactory
{ {
private readonly ParameterPolicyFactory _policyFactory; private readonly ParameterPolicyFactory _policyFactory;
#pragma warning disable CS0618 // Type or member is obsolete
private readonly ObjectPool<UriBuildingContext> _pool; private readonly ObjectPool<UriBuildingContext> _pool;
#pragma warning restore CS0618 // Type or member is obsolete
public DefaultTemplateBinderFactory( public DefaultTemplateBinderFactory(
ParameterPolicyFactory policyFactory, ParameterPolicyFactory policyFactory,
#pragma warning disable CS0618 // Type or member is obsolete
ObjectPool<UriBuildingContext> pool) ObjectPool<UriBuildingContext> pool)
#pragma warning restore CS0618 // Type or member is obsolete
{ {
if (policyFactory == null) if (policyFactory == null)
{ {
@ -50,9 +45,7 @@ namespace Microsoft.AspNetCore.Routing.Template
throw new ArgumentNullException(nameof(defaults)); throw new ArgumentNullException(nameof(defaults));
} }
#pragma warning disable CS0618 // Type or member is obsolete
return new TemplateBinder(UrlEncoder.Default, _pool, template, defaults); return new TemplateBinder(UrlEncoder.Default, _pool, template, defaults);
#pragma warning restore CS0618 // Type or member is obsolete
} }
public override TemplateBinder Create(RoutePattern pattern) public override TemplateBinder Create(RoutePattern pattern)

View File

@ -10,7 +10,6 @@ using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.AspNetCore.Routing.Patterns;
using Microsoft.Extensions.ObjectPool; using Microsoft.Extensions.ObjectPool;
@ -19,9 +18,7 @@ namespace Microsoft.AspNetCore.Routing.Template
public class TemplateBinder public class TemplateBinder
{ {
private readonly UrlEncoder _urlEncoder; private readonly UrlEncoder _urlEncoder;
#pragma warning disable CS0618 // Type or member is obsolete
private readonly ObjectPool<UriBuildingContext> _pool; private readonly ObjectPool<UriBuildingContext> _pool;
#pragma warning restore CS0618 // Type or member is obsolete
private readonly (string parameterName, IRouteConstraint constraint)[] _constraints; private readonly (string parameterName, IRouteConstraint constraint)[] _constraints;
private readonly RouteValueDictionary _defaults; private readonly RouteValueDictionary _defaults;
@ -42,14 +39,9 @@ namespace Microsoft.AspNetCore.Routing.Template
/// <param name="pool">The <see cref="ObjectPool{T}"/>.</param> /// <param name="pool">The <see cref="ObjectPool{T}"/>.</param>
/// <param name="template">The <see cref="RouteTemplate"/> to bind values to.</param> /// <param name="template">The <see cref="RouteTemplate"/> to bind values to.</param>
/// <param name="defaults">The default values for <paramref name="template"/>.</param> /// <param name="defaults">The default values for <paramref name="template"/>.</param>
[Obsolete( internal TemplateBinder(
"This constructor is obsolete and will be marked internal in a furture release. Use the TemplateBinderFactory service " +
"to create TemplateBinder instances.")]
public TemplateBinder(
UrlEncoder urlEncoder, UrlEncoder urlEncoder,
#pragma warning disable PUB0001
ObjectPool<UriBuildingContext> pool, ObjectPool<UriBuildingContext> pool,
#pragma warning restore PUB0001
RouteTemplate template, RouteTemplate template,
RouteValueDictionary defaults) RouteValueDictionary defaults)
: this(urlEncoder, pool, template?.ToRoutePattern(), defaults, requiredKeys: null, parameterPolicies: null) : this(urlEncoder, pool, template?.ToRoutePattern(), defaults, requiredKeys: null, parameterPolicies: null)
@ -67,14 +59,9 @@ namespace Microsoft.AspNetCore.Routing.Template
/// <param name="parameterPolicies"> /// <param name="parameterPolicies">
/// A list of (<see cref="string"/>, <see cref="IParameterPolicy"/>) pairs to evalute when producing a URI. /// A list of (<see cref="string"/>, <see cref="IParameterPolicy"/>) pairs to evalute when producing a URI.
/// </param> /// </param>
[Obsolete( internal TemplateBinder(
"This constructor is obsolete and will be marked internal in a future release. Use the TemplateBinderFactory service " +
"to create TemplateBinder instances.")]
public TemplateBinder(
UrlEncoder urlEncoder, UrlEncoder urlEncoder,
#pragma warning disable PUB0001
ObjectPool<UriBuildingContext> pool, ObjectPool<UriBuildingContext> pool,
#pragma warning restore PUB0001
RoutePattern pattern, RoutePattern pattern,
RouteValueDictionary defaults, RouteValueDictionary defaults,
IEnumerable<string> requiredKeys, IEnumerable<string> requiredKeys,
@ -124,9 +111,7 @@ namespace Microsoft.AspNetCore.Routing.Template
internal TemplateBinder( internal TemplateBinder(
UrlEncoder urlEncoder, UrlEncoder urlEncoder,
#pragma warning disable CS0618 // Type or member is obsolete
ObjectPool<UriBuildingContext> pool, ObjectPool<UriBuildingContext> pool,
#pragma warning restore CS0618 // Type or member is obsolete
RoutePattern pattern, RoutePattern pattern,
IEnumerable<(string parameterName, IParameterPolicy policy)> parameterPolicies) IEnumerable<(string parameterName, IParameterPolicy policy)> parameterPolicies)
{ {
@ -506,7 +491,6 @@ namespace Microsoft.AspNetCore.Routing.Template
} }
} }
#pragma warning disable CS0618 // Type or member is obsolete
private bool TryBindValuesCore(UriBuildingContext context, RouteValueDictionary acceptedValues) private bool TryBindValuesCore(UriBuildingContext context, RouteValueDictionary acceptedValues)
{ {
// If we have any output parameter transformers, allow them a chance to influence the parameter values // If we have any output parameter transformers, allow them a chance to influence the parameter values
@ -647,7 +631,6 @@ namespace Microsoft.AspNetCore.Routing.Template
} }
return false; return false;
} }
#pragma warning restore CS0618 // Type or member is obsolete
/// <summary> /// <summary>
/// Compares two objects for equality as parts of a case-insensitive path. /// Compares two objects for equality as parts of a case-insensitive path.

View File

@ -1,10 +1,9 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using Microsoft.AspNetCore.Routing.Internal;
namespace Microsoft.AspNetCore.Routing.Tree namespace Microsoft.AspNetCore.Routing.Tree
{ {

View File

@ -5,7 +5,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.AspNetCore.Routing.Template; using Microsoft.AspNetCore.Routing.Template;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.ObjectPool; using Microsoft.Extensions.ObjectPool;
@ -20,9 +19,7 @@ namespace Microsoft.AspNetCore.Routing.Tree
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly ILogger _constraintLogger; private readonly ILogger _constraintLogger;
private readonly UrlEncoder _urlEncoder; private readonly UrlEncoder _urlEncoder;
#pragma warning disable CS0618 // Type or member is obsolete
private readonly ObjectPool<UriBuildingContext> _objectPool; private readonly ObjectPool<UriBuildingContext> _objectPool;
#pragma warning restore CS0618 // Type or member is obsolete
private readonly IInlineConstraintResolver _constraintResolver; private readonly IInlineConstraintResolver _constraintResolver;
/// <summary> /// <summary>
@ -31,12 +28,9 @@ namespace Microsoft.AspNetCore.Routing.Tree
/// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param> /// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
/// <param name="objectPool">The <see cref="ObjectPool{UrlBuildingContext}"/>.</param> /// <param name="objectPool">The <see cref="ObjectPool{UrlBuildingContext}"/>.</param>
/// <param name="constraintResolver">The <see cref="IInlineConstraintResolver"/>.</param> /// <param name="constraintResolver">The <see cref="IInlineConstraintResolver"/>.</param>
[Obsolete("This constructor will be marked internal in a future release. Use the service provider to create instances of TreeRouteBuilder.")] internal TreeRouteBuilder(
public TreeRouteBuilder(
ILoggerFactory loggerFactory, ILoggerFactory loggerFactory,
#pragma warning disable CS0618, PUB0001 // Type or member is obsolete
ObjectPool<UriBuildingContext> objectPool, ObjectPool<UriBuildingContext> objectPool,
#pragma warning restore CS0618, PUB0001 // Type or member is obsolete
IInlineConstraintResolver constraintResolver) IInlineConstraintResolver constraintResolver)
{ {
if (loggerFactory == null) if (loggerFactory == null)
@ -244,7 +238,6 @@ namespace Microsoft.AspNetCore.Routing.Tree
tree.AddEntry(entry); tree.AddEntry(entry);
} }
#pragma warning disable CS0618 // Type or member is obsolete
return new TreeRouter( return new TreeRouter(
trees.Values.OrderBy(tree => tree.Order).ToArray(), trees.Values.OrderBy(tree => tree.Order).ToArray(),
OutboundEntries, OutboundEntries,
@ -253,7 +246,6 @@ namespace Microsoft.AspNetCore.Routing.Tree
_logger, _logger,
_constraintLogger, _constraintLogger,
version); version);
#pragma warning restore CS0618 // Type or member is obsolete
} }
/// <summary> /// <summary>

View File

@ -5,7 +5,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.AspNetCore.Routing.Logging; using Microsoft.AspNetCore.Routing.Logging;
using Microsoft.AspNetCore.Routing.Template; using Microsoft.AspNetCore.Routing.Template;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
@ -40,14 +39,11 @@ namespace Microsoft.AspNetCore.Routing.Tree
/// <param name="constraintLogger">The <see cref="ILogger"/> instance used /// <param name="constraintLogger">The <see cref="ILogger"/> instance used
/// in <see cref="RouteConstraintMatcher"/>.</param> /// in <see cref="RouteConstraintMatcher"/>.</param>
/// <param name="version">The version of this route.</param> /// <param name="version">The version of this route.</param>
[Obsolete("This constructor will be marked obsolete in a future release. Use the TreeRouterBuilder to create instances of TreeRouter.")] internal TreeRouter(
public TreeRouter(
UrlMatchingTree[] trees, UrlMatchingTree[] trees,
IEnumerable<OutboundRouteEntry> linkGenerationEntries, IEnumerable<OutboundRouteEntry> linkGenerationEntries,
UrlEncoder urlEncoder, UrlEncoder urlEncoder,
#pragma warning disable CS0618, PUB0001 // Type or member is obsolete
ObjectPool<UriBuildingContext> objectPool, ObjectPool<UriBuildingContext> objectPool,
#pragma warning restore CS0618, PUB0001 // Type or member is obsolete
ILogger routeLogger, ILogger routeLogger,
ILogger constraintLogger, ILogger constraintLogger,
int version) int version)

View File

@ -2,12 +2,10 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.Extensions.ObjectPool; using Microsoft.Extensions.ObjectPool;
namespace Microsoft.AspNetCore.Routing namespace Microsoft.AspNetCore.Routing
{ {
#pragma warning disable CS0618 // Type or member is obsolete
internal class UriBuilderContextPooledObjectPolicy : IPooledObjectPolicy<UriBuildingContext> internal class UriBuilderContextPooledObjectPolicy : IPooledObjectPolicy<UriBuildingContext>
{ {
public UriBuildingContext Create() public UriBuildingContext Create()
@ -21,5 +19,4 @@ namespace Microsoft.AspNetCore.Routing
return true; return true;
} }
} }
#pragma warning restore CS0618 // Type or member is obsolete
} }

View File

@ -1,7 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
@ -9,11 +8,10 @@ using System.Text;
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
namespace Microsoft.AspNetCore.Routing.Internal namespace Microsoft.AspNetCore.Routing
{ {
[Obsolete("This type will be marked as internal in a future release.")]
[DebuggerDisplay("{DebuggerToString(),nq}")] [DebuggerDisplay("{DebuggerToString(),nq}")]
public class UriBuildingContext internal class UriBuildingContext
{ {
// Holds the 'accepted' parts of the path. // Holds the 'accepted' parts of the path.
private readonly StringBuilder _path; private readonly StringBuilder _path;

View File

@ -6,7 +6,6 @@ using System.IO;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.AspNetCore.Routing.Patterns;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Primitives;
using Xunit; using Xunit;
namespace Microsoft.AspNetCore.Routing.Internal namespace Microsoft.AspNetCore.Routing.Internal

View File

@ -3,12 +3,9 @@
using System; using System;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.AspNetCore.Routing.Template; using Microsoft.AspNetCore.Routing.Template;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.ObjectPool;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Routing namespace Microsoft.AspNetCore.Routing

View File

@ -7,7 +7,6 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.AspNetCore.Routing.Template; using Microsoft.AspNetCore.Routing.Template;
using Microsoft.AspNetCore.Routing.TestObjects; using Microsoft.AspNetCore.Routing.TestObjects;
using Microsoft.AspNetCore.Routing.Tree; using Microsoft.AspNetCore.Routing.Tree;
@ -33,12 +32,10 @@ namespace Microsoft.AspNetCore.Routing.Matching
public override Matcher Build() public override Matcher Build()
{ {
#pragma warning disable CS0618 // Type or member is obsolete
var builder = new TreeRouteBuilder( var builder = new TreeRouteBuilder(
NullLoggerFactory.Instance, NullLoggerFactory.Instance,
new DefaultObjectPool<UriBuildingContext>(new UriBuilderContextPooledObjectPolicy()), new DefaultObjectPool<UriBuildingContext>(new UriBuilderContextPooledObjectPolicy()),
new DefaultInlineConstraintResolver(Options.Create(new RouteOptions()), new TestServiceProvider())); new DefaultInlineConstraintResolver(Options.Create(new RouteOptions()), new TestServiceProvider()));
#pragma warning restore CS0618 // Type or member is obsolete
var selector = new DefaultEndpointSelector(); var selector = new DefaultEndpointSelector();

View File

@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Primitives; using Microsoft.Extensions.Primitives;
using Xunit; using Xunit;
namespace Microsoft.AspNetCore.Routing.Internal namespace Microsoft.AspNetCore.Routing
{ {
public class PathTokenizerTest public class PathTokenizerTest
{ {

View File

@ -3,7 +3,6 @@
using System; using System;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Moq; using Moq;
using Xunit; using Xunit;

View File

@ -8,13 +8,11 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing.Constraints; using Microsoft.AspNetCore.Routing.Constraints;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.AspNetCore.Routing.TestObjects; using Microsoft.AspNetCore.Routing.TestObjects;
using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.ObjectPool;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Microsoft.Extensions.WebEncoders.Testing; using Microsoft.Extensions.WebEncoders.Testing;
using Moq; using Moq;

View File

@ -4,10 +4,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.AspNetCore.Routing.Patterns;
using Microsoft.AspNetCore.Routing.TestObjects; using Microsoft.AspNetCore.Routing.TestObjects;
using Microsoft.AspNetCore.Routing.Tree;
using Xunit; using Xunit;
namespace Microsoft.AspNetCore.Routing namespace Microsoft.AspNetCore.Routing

View File

@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Routing.Constraints; using Microsoft.AspNetCore.Routing.Constraints;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.AspNetCore.Routing.Patterns;
using Microsoft.AspNetCore.Routing.TestObjects; using Microsoft.AspNetCore.Routing.TestObjects;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -16,7 +15,6 @@ using Xunit;
namespace Microsoft.AspNetCore.Routing.Template.Tests namespace Microsoft.AspNetCore.Routing.Template.Tests
{ {
#pragma warning disable CS0618 // Type or member is obsolete
public class TemplateBinderTests public class TemplateBinderTests
{ {
private readonly IInlineConstraintResolver _inlineConstraintResolver = GetInlineConstraintResolver(); private readonly IInlineConstraintResolver _inlineConstraintResolver = GetInlineConstraintResolver();
@ -1481,5 +1479,4 @@ namespace Microsoft.AspNetCore.Routing.Template.Tests
public Dictionary<string, string> Parameters { get; private set; } public Dictionary<string, string> Parameters { get; private set; }
} }
} }
#pragma warning restore CS0618 // Type or member is obsolete
} }

View File

@ -1,9 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;

View File

@ -7,10 +7,9 @@ using System.Linq;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.AspNetCore.Routing.Patterns;
using Microsoft.AspNetCore.Routing.Template; using Microsoft.AspNetCore.Routing.Template;
using Microsoft.AspNetCore.Routing.Tree;
using Xunit; using Xunit;
namespace Microsoft.AspNetCore.Routing.Internal.Routing namespace Microsoft.AspNetCore.Routing.Tree
{ {
public class LinkGenerationDecisionTreeTest public class LinkGenerationDecisionTreeTest
{ {

View File

@ -1,8 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.AspNetCore.Routing.Template; using Microsoft.AspNetCore.Routing.Template;
using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -248,12 +246,10 @@ namespace Microsoft.AspNetCore.Routing.Tree
var objectPool = objectPoolProvider.Create(objectPolicy); var objectPool = objectPoolProvider.Create(objectPolicy);
var constraintResolver = GetInlineConstraintResolver(); var constraintResolver = GetInlineConstraintResolver();
#pragma warning disable CS0618 // Type or member is obsolete
var builder = new TreeRouteBuilder( var builder = new TreeRouteBuilder(
NullLoggerFactory.Instance, NullLoggerFactory.Instance,
objectPool, objectPool,
constraintResolver); constraintResolver);
#pragma warning restore CS0618 // Type or member is obsolete
return builder; return builder;
} }

View File

@ -4,10 +4,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.Encodings.Web;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing.Internal;
using Microsoft.AspNetCore.Routing.Template; using Microsoft.AspNetCore.Routing.Template;
using Microsoft.AspNetCore.Routing.TestObjects; using Microsoft.AspNetCore.Routing.TestObjects;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
@ -23,10 +21,8 @@ namespace Microsoft.AspNetCore.Routing.Tree
{ {
private static readonly RequestDelegate NullHandler = (c) => Task.CompletedTask; private static readonly RequestDelegate NullHandler = (c) => Task.CompletedTask;
#pragma warning disable CS0618 // Type or member is obsolete
private static ObjectPool<UriBuildingContext> Pool = new DefaultObjectPoolProvider().Create( private static ObjectPool<UriBuildingContext> Pool = new DefaultObjectPoolProvider().Create(
new UriBuilderContextPooledObjectPolicy()); new UriBuilderContextPooledObjectPolicy());
#pragma warning restore CS0618 // Type or member is obsolete
[Theory] [Theory]
[InlineData("template/5", "template/{parameter:int}")] [InlineData("template/5", "template/{parameter:int}")]
@ -2075,7 +2071,6 @@ namespace Microsoft.AspNetCore.Routing.Tree
return new DefaultInlineConstraintResolver(optionsMock.Object, new TestServiceProvider()); return new DefaultInlineConstraintResolver(optionsMock.Object, new TestServiceProvider());
} }
#pragma warning disable CS0618 // Type or member is obsolete
private static TreeRouteBuilder CreateBuilder() private static TreeRouteBuilder CreateBuilder()
{ {
var objectPoolProvider = new DefaultObjectPoolProvider(); var objectPoolProvider = new DefaultObjectPoolProvider();
@ -2089,7 +2084,6 @@ namespace Microsoft.AspNetCore.Routing.Tree
constraintResolver); constraintResolver);
return builder; return builder;
} }
#pragma warning restore CS0618 // Type or member is obsolete
private static TreeRouter CreateTreeRouter( private static TreeRouter CreateTreeRouter(
string firstTemplate, string firstTemplate,

View File

@ -4,9 +4,8 @@
using Microsoft.Extensions.WebEncoders.Testing; using Microsoft.Extensions.WebEncoders.Testing;
using Xunit; using Xunit;
namespace Microsoft.AspNetCore.Routing.Internal namespace Microsoft.AspNetCore.Routing
{ {
#pragma warning disable CS0618 // Type or member is obsolete
public class UriBuildingContextTest public class UriBuildingContextTest
{ {
[Fact] [Fact]
@ -98,5 +97,4 @@ namespace Microsoft.AspNetCore.Routing.Internal
Assert.Equal(expected, uriBuilldingContext.ToPathString().Value); Assert.Equal(expected, uriBuilldingContext.ToPathString().Value);
} }
} }
#pragma warning restore CS0618 // Type or member is obsolete
} }