using MediatR;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;

namespace Femto.Common.Infrastructure;

public static class DomainServiceExtensions 
{
    public static void ConfigureDomainServices<TContext>(this IServiceCollection services)
    where TContext : DbContext
    {          
        services.AddScoped<DbContext>(s => s.GetRequiredService<TContext>());
        services.AddTransient(
            typeof(IPipelineBehavior<,>),
            typeof(SaveChangesPipelineBehaviour<,>)
        );
        
    }
}