feat: разделение на repository - services
This commit is contained in:
@@ -4,27 +4,16 @@ using Npgsql;
|
||||
using PARR.Constants;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.DAL.Services.Abstracts;
|
||||
using PARR.DAL.Repositories.Base;
|
||||
using PARR.DAL.Services.Interfaces;
|
||||
using PARR.Domain.Entities.Base.History;
|
||||
using PARR.Domain.Enums;
|
||||
|
||||
namespace PARR.DAL.Services.Implementations
|
||||
{
|
||||
internal class TemplateService : BaseService<Template>, ITemplateService
|
||||
internal class TemplateService : BaseRepository<Template>, ITemplateService
|
||||
{
|
||||
private readonly DataContext dataContext;
|
||||
private readonly ILogger<TemplateService> logger;
|
||||
|
||||
protected override DbSet<Template> EntitySet => dataContext.Templates;
|
||||
|
||||
protected override DataContext EntitiContext => dataContext;
|
||||
|
||||
public TemplateService(DataContext dataContext, ILogger<TemplateService> logger) : base(logger)
|
||||
{
|
||||
this.dataContext = dataContext;
|
||||
this.logger = logger;
|
||||
}
|
||||
public TemplateService(DataContext dataContext, ILogger<TemplateService> logger) : base(logger, dataContext) { }
|
||||
|
||||
public async Task<Template?> GetTemplateByNameAsync(string name)
|
||||
{
|
||||
@@ -167,7 +156,7 @@ namespace PARR.DAL.Services.Implementations
|
||||
|
||||
try
|
||||
{
|
||||
var result = await dataContext.Database
|
||||
var result = await EntityContext.Database
|
||||
.SqlQueryRaw<Guid>(sql, parameters)
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user