feat: создана структура проекта, core, domain, infrastructure. Перенесены enum и task согласно архитектуры
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.Common.Domain;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.DomainModels;
|
||||
using PARR.DAL.Models.Base;
|
||||
using PARR.DAL.Models.Base.History.Base;
|
||||
using PARR.DAL.Services.Interfaces.Base;
|
||||
using PARR.Domain.Entities.Base;
|
||||
using PARR.Domain.Entities.Base.History;
|
||||
using PARR.Domain.Entities.Base.History.Base;
|
||||
using System.Reflection;
|
||||
|
||||
namespace PARR.DAL.Services.Abstracts
|
||||
{
|
||||
internal abstract class BaseService<T> : IBaseService<T> where T : class, IBase
|
||||
internal abstract class BaseService<T> : IBaseService<T> where T : class, IBaseEntity
|
||||
{
|
||||
private readonly ILogger<BaseService<T>> logger;
|
||||
|
||||
@@ -118,10 +118,10 @@ namespace PARR.DAL.Services.Abstracts
|
||||
/// <param name="obj"></param>
|
||||
private void DateModifiedResolver(EntityEntry obj)
|
||||
{
|
||||
if (obj.Entity is IBaseDateModified)
|
||||
if (obj.Entity is IBaseEntityDateModified)
|
||||
{
|
||||
logger.LogDebug("Обновляю DateModified для сущности типа {EntityType}", obj.Entity.GetType().Name);
|
||||
(obj.Entity as IBaseDateModified)!.DateModified = DateTimeOffset.UtcNow;
|
||||
(obj.Entity as IBaseEntityDateModified)!.DateModified = DateTimeOffset.UtcNow;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace PARR.DAL.Services.Abstracts
|
||||
FillHistoryProp(ref historyInstance, nameof(IHistoryTable.DateAddedToHistory), DateTimeOffset.UtcNow);
|
||||
|
||||
// Заполняем Id
|
||||
FillHistoryProp(ref historyInstance, nameof(IBase.Id), Guid.NewGuid());
|
||||
FillHistoryProp(ref historyInstance, nameof(IBaseEntity.Id), Guid.NewGuid());
|
||||
|
||||
try
|
||||
{
|
||||
@@ -202,7 +202,7 @@ namespace PARR.DAL.Services.Abstracts
|
||||
return;
|
||||
|
||||
//Смотрим, если это Id, записываем его в ParentId
|
||||
var histPropName = prop.Name == nameof(IBase.Id) ? nameof(IHistoryTable.ParentId) : prop.Name;
|
||||
var histPropName = prop.Name == nameof(IBaseEntity.Id) ? nameof(IHistoryTable.ParentId) : prop.Name;
|
||||
|
||||
var histProp = historyInstance.GetType().GetProperty(histPropName);
|
||||
if (histProp == null) continue;
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.Constants;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Contracts;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.DAL.Services.Abstracts;
|
||||
using PARR.DAL.Services.Interfaces;
|
||||
using PARR.Domain.Enums;
|
||||
|
||||
namespace PARR.DAL.Services.Implementations
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Models.TaskModels;
|
||||
using PARR.DAL.Services.Abstracts;
|
||||
using PARR.DAL.Services.Interfaces.TaskServices;
|
||||
using PARR.Domain.Entities.TaskEntities;
|
||||
|
||||
namespace PARR.DAL.Services.Implementations.TaskServices
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Models.TaskModels;
|
||||
using PARR.DAL.Services.Abstracts;
|
||||
using PARR.DAL.Services.Interfaces.TaskServices;
|
||||
using PARR.Domain.Entities.TaskEntities;
|
||||
|
||||
namespace PARR.DAL.Services.Implementations.TaskServices
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Models.TaskModels;
|
||||
using PARR.DAL.Services.Interfaces.TaskServices;
|
||||
using PARR.Domain.Entities.TaskEntities;
|
||||
|
||||
namespace PARR.DAL.Services.Implementations.TaskServices
|
||||
{
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Npgsql;
|
||||
using PARR.Common.Domain;
|
||||
using PARR.Constants;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Contracts;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.DAL.Services.Abstracts;
|
||||
using PARR.DAL.Services.Interfaces;
|
||||
using PARR.Domain.Entities.Base.History;
|
||||
using PARR.Domain.Enums;
|
||||
|
||||
namespace PARR.DAL.Services.Implementations
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using PARR.Common.Domain;
|
||||
using PARR.DAL.DomainModels;
|
||||
using PARR.DAL.Models.Base;
|
||||
using PARR.DAL.DomainModels;
|
||||
using PARR.Domain.Entities.Base;
|
||||
using PARR.Domain.Entities.Base.History;
|
||||
|
||||
namespace PARR.DAL.Services.Interfaces.Base
|
||||
{
|
||||
public interface IBaseService<T> where T : class, IBase
|
||||
public interface IBaseService<T> where T : class, IBaseEntity
|
||||
{
|
||||
Task<T?> GetAsync(Guid id);
|
||||
IQueryable<T> Get();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using PARR.Constants;
|
||||
using PARR.DAL.Contracts;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.DAL.Services.Interfaces.Base;
|
||||
using PARR.Domain.Enums;
|
||||
|
||||
namespace PARR.DAL.Services.Interfaces
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using PARR.Common.Domain;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.DAL.Services.Interfaces.Base;
|
||||
using PARR.Domain.Entities.Base.History;
|
||||
|
||||
namespace PARR.DAL.Services.Interfaces
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using PARR.DAL.Models.TaskModels;
|
||||
using PARR.DAL.Services.Interfaces.Base;
|
||||
using PARR.DAL.Services.Interfaces.Base;
|
||||
using PARR.Domain.Entities.TaskEntities;
|
||||
|
||||
namespace PARR.DAL.Services.Interfaces.TaskServices
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using PARR.DAL.Models.TaskModels;
|
||||
using PARR.DAL.Services.Interfaces.Base;
|
||||
using PARR.DAL.Services.Interfaces.Base;
|
||||
using PARR.Domain.Entities.TaskEntities;
|
||||
|
||||
namespace PARR.DAL.Services.Interfaces.TaskServices
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using PARR.DAL.Models.TaskModels;
|
||||
using PARR.Domain.Entities.TaskEntities;
|
||||
|
||||
namespace PARR.DAL.Services.Interfaces.TaskServices
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user