using GerstITS.Data.EntityFramework; using GerstITS.Examples.JobDashboard.Configurations; using GerstITS.Examples.JobDashboard.Data; using GerstITS.Examples.JobDashboard.Jobs; using GerstITS.IoC; using GerstITS.Job.Scheduling; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; namespace GerstITS.Examples.JobDashboard; public sealed class Module : IIoCModule { #region IIoCModule public void RegisterComponents(IServiceCollection container) { RegisterInMemoryStore(container); RegisterJobs(container); } #endregion #region Methods private static void RegisterInMemoryStore(IServiceCollection container) { // The InMemory provider has no migrations, so disable the framework's auto-migration startup task. container.AddSingleton(); // Wire the EF Core InMemory provider through the framework's session (unit of work). No real database. container.AddScoped(); container.AddTransient(_ => new DbContextOptionsBuilder().Options); container.AddScoped(); container.AddEntityFrameworkSession(); } private static void RegisterJobs(IServiceCollection container) { container.RegisterJob(IgnoreConditions.EntityFramework, IgnoreConditions.Swagger); } #endregion }