Add Exception middleware
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user