Files
StandManager/StandManager.Service/Repository/StandManagerUnitOfWork.cs
2025-12-01 09:56:00 +01:00

27 lines
1.0 KiB
C#

using Microsoft.Extensions.DependencyInjection;
using OAService.Infrastructure.DAL.Repository;
using StandManager.Domain.Entita;
using StandManager.Infrastructure.DAL.Context;
namespace StandManager.Service.Repository;
public class StandManagerUnitOfWork : UnitOfWork, IStandManagerUnitOfWork
{
private readonly StandManagerDbContext _context;
private readonly IServiceProvider _provider;
public StandManagerUnitOfWork(StandManagerDbContext context, IServiceProvider provider) : base(context, provider)
{
_context = context;
_provider = provider;
}
public override IStandManagerGenericRepository<TEntity> GetRepository<TEntity>() where TEntity : class
{
return _provider.GetRequiredService<IStandManagerGenericRepository<TEntity>>();
}
private IStandManagerGenericRepository<Utente> _utenteRepository;
public new IStandManagerGenericRepository<Utente> UtenteRepository => _utenteRepository ??= new StandManagerGenericRepository<Utente>(_context);
}