Add Exception middleware

This commit is contained in:
2022-09-01 23:02:49 +01:00
parent 2ac5937096
commit dcf3b1020a
14 changed files with 241 additions and 90 deletions

View File

@@ -1,17 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Diary.Data
namespace Diary.Data
{
public class UnitOfWork
{
public UnitOfWork()
{
public interface IUnitOfWork
{
Task CompleteAsync();
}
public class UnitOfWork:IUnitOfWork
{
private readonly IDiaryDBContext _context;
public UnitOfWork(IDiaryDBContext context)
{
_context = context ?? throw new ArgumentNullException(nameof(context));
}
public async Task CompleteAsync()
{
await _context.SaveChangesAsync();
}
}
}
}