mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-05-24 00:52:23 -04:00
29 lines
1009 B
C#
29 lines
1009 B
C#
using API.Data;
|
|
using API.Helpers;
|
|
using API.Interfaces;
|
|
using API.Services;
|
|
using AutoMapper;
|
|
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<IUserRepository, UserRepository>();
|
|
services.AddScoped<ITokenService, TokenService>();
|
|
services.AddScoped<IDirectoryService, DirectoryService>();
|
|
services.AddScoped<ILibraryRepository, LibraryRepository>();
|
|
services.AddDbContext<DataContext>(options =>
|
|
{
|
|
options.UseSqlite(config.GetConnectionString("DefaultConnection"));
|
|
});
|
|
|
|
return services;
|
|
}
|
|
}
|
|
} |