<commit_before>using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Dotnettency;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.FileProviders;
using Microsoft.AspNetCore.Http;
using System.Threading.Tasks;

namespace Sample.Pages
{
    public class Startup
    {
        [Obsolete]
        public Startup(IConfiguration configuration, IWebHostEnvironment environment)
        {
            Configuration = configuration;
            Environment = environment;
        }

        public IConfiguration Configuration { get; }
        public IWebHostEnvironment Environment { get; }


        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var defaultServices = services.Clone();

            services.Configure<CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded = context => true;
            });

            services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
            services.AddMultiTenancy<Tenant>((builder) =>
             {
                 builder.IdentifyTenantsWithRequestAuthorityUri()
                        .InitialiseTenant<TenantShellFactory>()
                        .AddAspNetCore()
                        .ConfigureTenantFileProviders((hostingOptions) =>
                        {
                            var hostWebRootFileProvider = Environment.WebRootFileProvider;
                            hostingOptions.ConfigureTenantWebRootFileProvider(Environment.WebRootPath, (webRootOptions) =>
                            {
                                // WE use the tenant's guid id to partition one tenants files from another on disk.
                                Guid tenantGuid = (webRootOptions.Tenant?.TenantGuid).GetValueOrDefault();
                                webRootOptions.TenantPartitionId(tenantGuid)
                                                   .AllowAccessTo(hostWebRootFileProvider); // We allow the tenant web root file provider to access the environments web root files.
                            }, fp =>
                            {
                                // The file provider we add here, is one that dynamically switches based on the active tenant partition configuration above.
                                Environment.WebRootFileProvider = new CompositeFileProvider(new[] { fp, hostWebRootFileProvider });
                            });

                            var hostContentRootFileProvider = Environment.ContentRootFileProvider;
                            hostingOptions.ConfigureTenantWebRootFileProvider(Environment.ContentRootPath, (contentRootOptions) =>
                            {
                                // WE use the tenant's guid id to partition one tenants files from another on disk.
                                Guid tenantGuid = (contentRootOptions.Tenant?.TenantGuid).GetValueOrDefault();
                                contentRootOptions.TenantPartitionId(tenantGuid)
                                                   .AllowAccessTo(hostContentRootFileProvider); // We allow the tenant web root file provider to access the environments web root files.
                            }, fp =>
                            {
                                // The file provider we add here, is one that dynamically switches based on the active tenant partition configuration above.
                                Environment.ContentRootFileProvider = new CompositeFileProvider(new[] { fp, hostContentRootFileProvider });
                            });

                        })
                        .ConfigureTenantConfiguration((a) =>
                        {<commit_msg>Sample fix<commit_after>using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Dotnettency;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.FileProviders;
using Microsoft.AspNetCore.Http;
using System.Threading.Tasks;

namespace Sample.Pages
{
    public class Startup
    {
        [Obsolete]
        public Startup(IConfiguration configuration, IWebHostEnvironment environment)
        {
            Configuration = configuration;
            Environment = environment;
        }

        public IConfiguration Configuration { get; }
        public IWebHostEnvironment Environment { get; }


        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var defaultServices = services.Clone();

            services.Configure<CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded = context => true;
            });

            services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
            services.AddMultiTenancy<Tenant>((builder) =>
             {
                 builder.IdentifyTenantsWithRequestAuthorityUri()
                        .InitialiseTenant<TenantShellFactory>()
                        .AddAspNetCore()
                        .ConfigureTenantFileProviders((hostingOptions) =>
                        {
                            var hostWebRootFileProvider = Environment.WebRootFileProvider;
                            hostingOptions.ConfigureTenantWebRootFileProvider(Environment.WebRootPath, (webRootOptions) =>
                            {
                                // WE use the tenant's guid id to partition one tenants files from another on disk.
                                Guid tenantGuid = (webRootOptions.Tenant?.TenantGuid).GetValueOrDefault();
                                webRootOptions.TenantPartitionId(tenantGuid)
                                                   .AllowAccessTo(hostWebRootFileProvider); // We allow the tenant web root file provider to access the environments web root files.
                            }, fp =>
                            {
                                // The file provider we add here, is one that dynamically switches based on the active tenant partition configuration above.
                                Environment.WebRootFileProvider = new CompositeFileProvider(new[] { fp, hostWebRootFileProvider });
                            });

                            var hostContentRootFileProvider = Environment.ContentRootFileProvider;
                            hostingOptions.ConfigureTenantContentFileProvider(Environment.ContentRootPath, (contentRootOptions) =>
                            {
                                // WE use the tenant's guid id to partition one tenants files from another on disk.
                                Guid tenantGuid = (contentRootOptions.Tenant?.TenantGuid).GetValueOrDefault();
                                contentRootOptions.TenantPartitionId(tenantGuid)
                                                   .AllowAccessTo(hostContentRootFileProvider); // We allow the tenant web root file provider to access the environments web root files.
                            }, fp =>
                            {
                                // The file provider we add here, is one that dynamically switches based on the active tenant partition configuration above.
                                Environment.ContentRootFileProvider = new CompositeFileProvider(new[] { fp, hostContentRootFileProvider });
                            });

                        })
                        .ConfigureTenantConfiguration((a) =>
                        {
{'fraction_non_alphanumeric': 0.059077987887776545, 'fraction_numerical': 0.0, 'mean_word_length': 1.6618421052631578, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6193151', 'n_tokens_mistral': 1635, 'n_tokens_neox': 1586, 'n_words': 447}