mirror of
				https://github.com/Kareadita/Kavita.git
				synced 2025-10-31 10:37:04 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			41 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using API.Data;
 | |
| using API.Helpers;
 | |
| using API.Interfaces;
 | |
| using API.Services;
 | |
| using AutoMapper;
 | |
| using Hangfire;
 | |
| using Hangfire.LiteDB;
 | |
| using Microsoft.EntityFrameworkCore;
 | |
| using Microsoft.Extensions.Configuration;
 | |
| using Microsoft.Extensions.DependencyInjection;
 | |
| 
 | |
| namespace API.Extensions
 | |
| {
 | |
|     public static class ApplicationServiceExtensions
 | |
|     {
 | |
|         public static IServiceCollection AddApplicationServices(this IServiceCollection services, IConfiguration config)
 | |
|         {
 | |
|             services.AddAutoMapper(typeof(AutoMapperProfiles).Assembly);
 | |
|             services.AddScoped<ITaskScheduler, TaskScheduler>();
 | |
|             services.AddScoped<IUserRepository, UserRepository>();
 | |
|             services.AddScoped<ITokenService, TokenService>();
 | |
|             services.AddScoped<ISeriesRepository, SeriesRepository>();
 | |
|             services.AddScoped<IDirectoryService, DirectoryService>();
 | |
|             services.AddScoped<ILibraryRepository, LibraryRepository>();
 | |
|             services.AddDbContext<DataContext>(options =>
 | |
|             {
 | |
|                 options.UseSqlite(config.GetConnectionString("DefaultConnection"));
 | |
|             });
 | |
| 
 | |
|             services.AddHangfire(configuration => configuration
 | |
|                 .UseSimpleAssemblyNameTypeSerializer()
 | |
|                 .UseRecommendedSerializerSettings()
 | |
|                 .UseLiteDbStorage());
 | |
|             
 | |
|             // Add the processing server as IHostedService
 | |
|             services.AddHangfireServer();
 | |
| 
 | |
|             return services;
 | |
|         }
 | |
|     }
 | |
| } |