Add transaction support between services
This commit is contained in:
15
Hcs.WebApp/Services/HcsServiceBase.cs
Normal file
15
Hcs.WebApp/Services/HcsServiceBase.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using Hcs.WebApp.Data.Hcs;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Hcs.WebApp.Services
|
||||
{
|
||||
public abstract class HcsServiceBase(IDbContextFactory<HcsDbContext> factory)
|
||||
{
|
||||
private readonly IDbContextFactory<HcsDbContext> factory = factory;
|
||||
|
||||
public HcsDbContext GetNewContext()
|
||||
{
|
||||
return factory.CreateDbContext();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user