Files
Backend-Api/CompanyManagment.EFCore/_common/UnitOfWork.cs
2025-11-26 13:37:04 +03:30

32 lines
676 B
C#

using AccountMangement.Infrastructure.EFCore;
using Company.Domain._common;
using Microsoft.EntityFrameworkCore.Storage;
namespace CompanyManagment.EFCore._common;
public class UnitOfWork : IUnitOfWork
{
private readonly AccountContext _context;
private IDbContextTransaction _transaction;
public UnitOfWork(AccountContext context)
{
_context = context;
}
public void BeginAccountContext()
{
_transaction = _context.Database.BeginTransaction();
}
public void CommitAccountContext()
{
_transaction?.Commit();
}
public void RollbackAccountContext()
{
_transaction?.Rollback();
}
}