From c521599974a3c479af9bea6fbf2fddb25feeb22d Mon Sep 17 00:00:00 2001 From: "BRUCE.L" Date: Thu, 2 Feb 2023 03:57:23 -0800 Subject: [PATCH] Implementing dispose --- src/Wax.Core/Repositories/IUnitOfWork.cs | 2 +- src/Wax.Core/Repositories/UnitOfWork.cs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Wax.Core/Repositories/IUnitOfWork.cs b/src/Wax.Core/Repositories/IUnitOfWork.cs index c466450..16ad33c 100644 --- a/src/Wax.Core/Repositories/IUnitOfWork.cs +++ b/src/Wax.Core/Repositories/IUnitOfWork.cs @@ -1,6 +1,6 @@ namespace Wax.Core.Repositories; -public interface IUnitOfWork +public interface IUnitOfWork : IDisposable { public ICustomerRepository Customers { get; } Task SaveChangesAsync(CancellationToken cancellationToken = default); diff --git a/src/Wax.Core/Repositories/UnitOfWork.cs b/src/Wax.Core/Repositories/UnitOfWork.cs index aeeed19..bc3a91f 100644 --- a/src/Wax.Core/Repositories/UnitOfWork.cs +++ b/src/Wax.Core/Repositories/UnitOfWork.cs @@ -20,4 +20,9 @@ public Task SaveChangesAsync(CancellationToken cancellationToken = default) { return _context.SaveChangesAsync(cancellationToken); } + + public void Dispose() + { + _context?.Dispose(); + } } \ No newline at end of file