using Markdig; using Microsoft.Extensions.DependencyInjection; using OliverBooth.Common.Data.Blog; using OliverBooth.Common.Data.Web; using OliverBooth.Common.Markdown.Template; using OliverBooth.Common.Services; using X10D.Hosting.DependencyInjection; namespace OliverBooth.Common.Extensions; /// /// Extension methods for dependency injection. /// public static class DependencyInjectionExtensions { /// /// Adds all required services provided by the assembly to the current . /// /// The to add the service to. public static void AddCommonServices(this IServiceCollection collection) { collection.AddSingleton(provider => new MarkdownPipelineBuilder() // .Use() .Use(new TemplateExtension(provider.GetRequiredService())) .UseAdvancedExtensions() .UseBootstrap() .UseEmojiAndSmiley() .UseSmartyPants() .Build()); collection.AddDbContextFactory(); collection.AddDbContextFactory(); collection.AddSingleton(); collection.AddSingleton(); collection.AddSingleton(); collection.AddSingleton(); collection.AddSingleton(); collection.AddHostedSingleton(); collection.AddHostedSingleton(); } }