26 lines
664 B
C#
26 lines
664 B
C#
using IM.Application.Abstractions;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace IM.Infrastructure.Efcore
|
|
{
|
|
public sealed class EfUnitOfWork<TDbContext> : IUnitOfWork where TDbContext : DbContext
|
|
{
|
|
private readonly TDbContext dbContext;
|
|
|
|
public EfUnitOfWork(TDbContext dbContext)
|
|
{
|
|
this.dbContext = dbContext;
|
|
}
|
|
|
|
public Task SaveChangesAsync(CancellationToken cancellationToken = default)
|
|
{
|
|
return dbContext.SaveChangesAsync(cancellationToken);
|
|
}
|
|
}
|
|
}
|