26 lines
935 B
C#
26 lines
935 B
C#
using Knot.Contracts.Relations.Application.Abstractions;
|
|
using Knot.Modules.Relations.Application.Abstractions;
|
|
using Knot.Modules.Relations.Infrastructure.Persistence;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace Knot.Modules.Relations;
|
|
|
|
public static class DependencyInjection
|
|
{
|
|
public static IServiceCollection AddRelationsModule(this IServiceCollection services, IConfiguration configuration)
|
|
{
|
|
var connectionString = configuration.GetConnectionString("DefaultConnection");
|
|
services.AddDbContext<RelationsDbContext>(options =>
|
|
options.UseNpgsql(connectionString));
|
|
|
|
services.AddScoped<IFriendshipRepository, FriendshipRepository>();
|
|
|
|
services.AddMediatR(config =>
|
|
config.RegisterServicesFromAssembly(typeof(DependencyInjection).Assembly));
|
|
|
|
return services;
|
|
}
|
|
}
|