x-lab-lbq-technical-test/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/ServiceDependencies.cs

18 lines
637 B
C#

using LeedsBeerQuest.API.Data.Contexts;
using LeedsBeerQuest.API.Data.Services;
using LeedsBeerQuest.API.Data.Services.Interfaces;
using Microsoft.EntityFrameworkCore;
namespace LeedsBeerQuest.API;
public static class ServiceDependencies
{
public static void AddServiceDependencies(this IServiceCollection serviceCollection)
{
var dbOptions = new DbContextOptionsBuilder<LeedsBeerQuestDbContext>();
dbOptions.UseSqlite("Data Source=lbq.db");
serviceCollection.AddTransient(_ => new LeedsBeerQuestDbContext(dbOptions.Options));
serviceCollection.AddScoped<IVenueService, VenueService>();
}
}