<commit_before>// 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 System;
using System.Text.Encodings.Web;
using Microsoft.AspNet.Routing;
using Microsoft.AspNet.Routing.Internal;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.ObjectPool;

namespace Microsoft.Extensions.DependencyInjection
{
    /// <summary>
    /// Contains extension methods to <see cref="IServiceCollection"/>.
    /// </summary>
    public static class RoutingServiceCollectionExtensions
    {
        public static IServiceCollection AddRouting(this IServiceCollection services)
        {
            return AddRouting(services, configureOptions: null);
        }

        public static IServiceCollection AddRouting(
            this IServiceCollection services,
            Action<RouteOptions> configureOptions)
        {
            services.AddOptions();
            services.TryAddTransient<IInlineConstraintResolver, DefaultInlineConstraintResolver>();
            services.TryAddSingleton(UrlEncoder.Default);
            services.TryAddSingleton<ObjectPoolProvider>(new DefaultObjectPoolProvider());
            services.TryAddSingleton<ObjectPool<UriBuildingContext>>(s =>
            {
                var provider = s.GetRequiredService<ObjectPoolProvider>();
                var encoder = s.GetRequiredService<UrlEncoder>();
                return provider.Create<UriBuildingContext>(new UriBuilderContextPooledObjectPolicy(encoder));
            });

            if (configureOptions != null)
            {
                services.Configure(configureOptions);
            }<commit_msg>Remove redundant AddOptions which is now a default hosting service<commit_after>// 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 System;
using System.Text.Encodings.Web;
using Microsoft.AspNet.Routing;
using Microsoft.AspNet.Routing.Internal;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.ObjectPool;

namespace Microsoft.Extensions.DependencyInjection
{
    /// <summary>
    /// Contains extension methods to <see cref="IServiceCollection"/>.
    /// </summary>
    public static class RoutingServiceCollectionExtensions
    {
        public static IServiceCollection AddRouting(this IServiceCollection services)
        {
            return AddRouting(services, configureOptions: null);
        }

        public static IServiceCollection AddRouting(
            this IServiceCollection services,
            Action<RouteOptions> configureOptions)
        {
            services.TryAddTransient<IInlineConstraintResolver, DefaultInlineConstraintResolver>();
            services.TryAddSingleton(UrlEncoder.Default);
            services.TryAddSingleton<ObjectPoolProvider>(new DefaultObjectPoolProvider());
            services.TryAddSingleton<ObjectPool<UriBuildingContext>>(s =>
            {
                var provider = s.GetRequiredService<ObjectPoolProvider>();
                var encoder = s.GetRequiredService<UrlEncoder>();
                return provider.Create<UriBuildingContext>(new UriBuilderContextPooledObjectPolicy(encoder));
            });

            if (configureOptions != null)
            {
                services.Configure(configureOptions);
            }
{'fraction_non_alphanumeric': 0.08137535816618911, 'fraction_numerical': 0.001146131805157593, 'mean_word_length': 3.0126436781609196, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2374982', 'n_tokens_mistral': 792, 'n_tokens_neox': 784, 'n_words': 186}