<commit_before>﻿using System.Reflection;
using Blogifier.Core.Common;
using Blogifier.Core.Data;
using Blogifier.Core.Data.Interfaces;
using Blogifier.Core.Data.Repositories;
using Blogifier.Core.Middleware;
using Blogifier.Core.Services.FileSystem;
using Blogifier.Core.Services.Syndication.Rss;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Logging;

namespace Blogifier.Core
{
	public class Configuration
    {
		public static void InitServices(IServiceCollection services)
		{
			services.AddTransient<IRssService, RssService>();
			services.AddTransient<IBlogStorage, BlogStorage>();

			AddDatabase(services);

			AddFileProviders(services);
		}

		public static void InitApplication(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
		{
			app.UseMiddleware<EmbeddedResources>();

			ApplicationSettings.WebRootPath = env.WebRootPath;
			ApplicationSettings.ContentRootPath = env.ContentRootPath;

            var loader = new AppSettingsLoader();
            loader.LoadFromConfigFile();
		}

		static void AddDatabase(IServiceCollection services)
		{
			services.AddSingleton<IUnitOfWork, UnitOfWork>();

			services.AddDbContext<BlogifierDbContext>(options =>
				options.UseInMemoryDatabase());
		}

		static void AddFileProviders(IServiceCollection services)
		{
			var assemblyName = "Blogifier.Core";

			try
			{
				var assembly = Assembly.Load(new AssemblyName(assemblyName));

				services.Configure<RazorViewEngineOptions>(options =>
				{
					//options.FileProviders.Insert(0, new EmbeddedFileProvider(assembly, assemblyName));
					options.FileProviders.Add(new EmbeddedFileProvider(assembly, assemblyName));
				});
			}
			catch (System.Exception ex)
			{
				// var x = ex.Message;
			}
			
		}
	}
}
<commit_msg>file provider order<commit_after>﻿using System.Reflection;
using Blogifier.Core.Common;
using Blogifier.Core.Data;
using Blogifier.Core.Data.Interfaces;
using Blogifier.Core.Data.Repositories;
using Blogifier.Core.Middleware;
using Blogifier.Core.Services.FileSystem;
using Blogifier.Core.Services.Syndication.Rss;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Logging;

namespace Blogifier.Core
{
	public class Configuration
    {
		public static void InitServices(IServiceCollection services)
		{
			services.AddTransient<IRssService, RssService>();
			services.AddTransient<IBlogStorage, BlogStorage>();

			AddDatabase(services);

			AddFileProviders(services);
		}

		public static void InitApplication(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
		{
			app.UseMiddleware<EmbeddedResources>();

			ApplicationSettings.WebRootPath = env.WebRootPath;
			ApplicationSettings.ContentRootPath = env.ContentRootPath;

            var loader = new AppSettingsLoader();
            loader.LoadFromConfigFile();
		}

		static void AddDatabase(IServiceCollection services)
		{
			services.AddSingleton<IUnitOfWork, UnitOfWork>();

			services.AddDbContext<BlogifierDbContext>(options =>
				options.UseInMemoryDatabase());
		}

		static void AddFileProviders(IServiceCollection services)
		{
			var assemblyName = "Blogifier.Core";

			try
			{
				var assembly = Assembly.Load(new AssemblyName(assemblyName));

				services.Configure<RazorViewEngineOptions>(options =>
				{
					options.FileProviders.Insert(0, new EmbeddedFileProvider(assembly, assemblyName));
					//options.FileProviders.Add(new EmbeddedFileProvider(assembly, assemblyName));
				});
			}
			catch (System.Exception ex)
			{
				// var x = ex.Message;
			}
			
		}
	}
}

{'fraction_non_alphanumeric': 0.09507042253521127, 'fraction_numerical': 0.0005030181086519115, 'mean_word_length': 4.891851851851852, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, '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': '803138', 'n_tokens_mistral': 1269, 'n_tokens_neox': 1124, 'n_words': 200}