Initial
This commit is contained in:
27
StandManager.Service/Repository/StandManagerUnitOfWork.cs
Normal file
27
StandManager.Service/Repository/StandManagerUnitOfWork.cs
Normal file
@ -0,0 +1,27 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user