diff --git a/PARR.API/Controllers/V1/AgentHistoryController.cs b/PARR.API/Controllers/V1/AgentHistoryController.cs index c36e4a92..4d6ac08f 100644 --- a/PARR.API/Controllers/V1/AgentHistoryController.cs +++ b/PARR.API/Controllers/V1/AgentHistoryController.cs @@ -12,10 +12,10 @@ using PARR.API.Controllers.V1.Base; using PARR.API.Extensions; using PARR.API.Services.Interfaces; using PARR.Constants; -using PARR.DAL.DomainModels; using PARR.DAL.Models; using PARR.DAL.Services.Interfaces; using PARR.DAL.Services.Interfaces.Unit; +using PARR.Domain.Common.Pagination; namespace PARR.API.Controllers.V1 { diff --git a/PARR.API/Controllers/V1/ApplicationController.cs b/PARR.API/Controllers/V1/ApplicationController.cs index 7838cced..51f007f3 100644 --- a/PARR.API/Controllers/V1/ApplicationController.cs +++ b/PARR.API/Controllers/V1/ApplicationController.cs @@ -9,9 +9,9 @@ using PARR.API.Contracts.V1.Responses.Base; using PARR.API.Controllers.V1.Base; using PARR.API.Extensions; using PARR.Constants; -using PARR.DAL.DomainModels; using PARR.DAL.Models; using PARR.DAL.Services.Interfaces; +using PARR.Domain.Common.Pagination; namespace PARR.API.Controllers.V1 { diff --git a/PARR.API/Controllers/V1/JobController.cs b/PARR.API/Controllers/V1/JobController.cs index 24ddf246..c799c350 100644 --- a/PARR.API/Controllers/V1/JobController.cs +++ b/PARR.API/Controllers/V1/JobController.cs @@ -16,7 +16,6 @@ using PARR.BLL.Domain.Mq; using PARR.BLL.Helpers; using PARR.BLL.Services.Interfaces; using PARR.Constants; -using PARR.DAL.DomainModels; using PARR.DAL.DomainServices.Interfaces; using PARR.DAL.DomainServices.UnitFilterService; using PARR.DAL.Extensions; @@ -24,6 +23,7 @@ using PARR.DAL.Models.Job; using PARR.DAL.Services.Interfaces; using PARR.DAL.Services.Interfaces.Job; using PARR.DAL.Services.Interfaces.Unit; +using PARR.Domain.Common.Pagination; using PARR.Domain.Entities.Base.History; using PARR.Domain.Enums; diff --git a/PARR.API/Controllers/V1/JobGroupController.cs b/PARR.API/Controllers/V1/JobGroupController.cs index 0e3fb20b..624e9e04 100644 --- a/PARR.API/Controllers/V1/JobGroupController.cs +++ b/PARR.API/Controllers/V1/JobGroupController.cs @@ -16,13 +16,13 @@ using PARR.BLL.Domain.Mq; using PARR.BLL.Helpers; using PARR.BLL.Services.Interfaces; using PARR.Constants; -using PARR.DAL.DomainModels; using PARR.DAL.DomainServices.Interfaces; using PARR.DAL.Models; using PARR.DAL.Models.Job; using PARR.DAL.Services.Interfaces; using PARR.DAL.Services.Interfaces.Job; using PARR.DAL.Services.Interfaces.Schedule; +using PARR.Domain.Common.Pagination; using PARR.Domain.Entities.Base.History; using PARR.Domain.Enums; diff --git a/PARR.API/Controllers/V1/OrderController.cs b/PARR.API/Controllers/V1/OrderController.cs index f71368dd..f6887a24 100644 --- a/PARR.API/Controllers/V1/OrderController.cs +++ b/PARR.API/Controllers/V1/OrderController.cs @@ -9,9 +9,9 @@ using PARR.API.Contracts.V1.Responses.Base; using PARR.API.Controllers.V1.Base; using PARR.API.Extensions; using PARR.Constants; -using PARR.DAL.DomainModels; using PARR.DAL.Models; using PARR.DAL.Services.Interfaces; +using PARR.Domain.Common.Pagination; namespace PARR.API.Controllers.V1 { diff --git a/PARR.API/Controllers/V1/ProcessController.cs b/PARR.API/Controllers/V1/ProcessController.cs index aca9ca5b..9273a2bb 100644 --- a/PARR.API/Controllers/V1/ProcessController.cs +++ b/PARR.API/Controllers/V1/ProcessController.cs @@ -12,9 +12,9 @@ using PARR.API.Controllers.V1.Base; using PARR.API.Extensions; using PARR.API.Services.Interfaces; using PARR.Constants; -using PARR.DAL.DomainModels; using PARR.DAL.Models; using PARR.DAL.Services.Interfaces; +using PARR.Domain.Common.Pagination; namespace PARR.API.Controllers.V1 { diff --git a/PARR.API/Controllers/V1/RobotHistoryController.cs b/PARR.API/Controllers/V1/RobotHistoryController.cs index db8ea006..818caa19 100644 --- a/PARR.API/Controllers/V1/RobotHistoryController.cs +++ b/PARR.API/Controllers/V1/RobotHistoryController.cs @@ -12,9 +12,9 @@ using PARR.API.Controllers.V1.Base; using PARR.API.Extensions; using PARR.API.Services.Interfaces; using PARR.Constants; -using PARR.DAL.DomainModels; using PARR.DAL.Models; using PARR.DAL.Services.Interfaces; +using PARR.Domain.Common.Pagination; namespace PARR.API.Controllers.V1 { diff --git a/PARR.API/Controllers/V1/SubprocessController.cs b/PARR.API/Controllers/V1/SubprocessController.cs index cc0055f8..c6a1d005 100644 --- a/PARR.API/Controllers/V1/SubprocessController.cs +++ b/PARR.API/Controllers/V1/SubprocessController.cs @@ -12,9 +12,9 @@ using PARR.API.Controllers.V1.Base; using PARR.API.Extensions; using PARR.API.Services.Interfaces; using PARR.Constants; -using PARR.DAL.DomainModels; using PARR.DAL.Models; using PARR.DAL.Services.Interfaces; +using PARR.Domain.Common.Pagination; namespace PARR.API.Controllers.V1 { diff --git a/PARR.API/Controllers/V1/TemplateController.cs b/PARR.API/Controllers/V1/TemplateController.cs index f1ee5cb6..dfb2436c 100644 --- a/PARR.API/Controllers/V1/TemplateController.cs +++ b/PARR.API/Controllers/V1/TemplateController.cs @@ -13,11 +13,11 @@ using PARR.API.Services.Interfaces; using PARR.BLL.Helpers; using PARR.Constants; using PARR.DAL.Contracts; -using PARR.DAL.DomainModels; using PARR.DAL.DomainServices.Shortcodes; using PARR.DAL.Models; using PARR.DAL.Services.Interfaces; using PARR.DAL.Services.Interfaces.Schedule; +using PARR.Domain.Common.Pagination; using PARR.Domain.Entities.Base.History; using PARR.Domain.Enums; diff --git a/PARR.API/Controllers/V1/TemplateHistoryController.cs b/PARR.API/Controllers/V1/TemplateHistoryController.cs index f88a046d..8f1344ba 100644 --- a/PARR.API/Controllers/V1/TemplateHistoryController.cs +++ b/PARR.API/Controllers/V1/TemplateHistoryController.cs @@ -9,9 +9,9 @@ using PARR.API.Contracts.V1.Responses.Base; using PARR.API.Controllers.V1.Base; using PARR.API.Extensions; using PARR.Constants; -using PARR.DAL.DomainModels; using PARR.DAL.Models; using PARR.DAL.Services.Interfaces; +using PARR.Domain.Common.Pagination; namespace PARR.API.Controllers.V1 { diff --git a/PARR.API/Controllers/V1/TnkController.cs b/PARR.API/Controllers/V1/TnkController.cs index 33fd84dd..ff8d63bd 100644 --- a/PARR.API/Controllers/V1/TnkController.cs +++ b/PARR.API/Controllers/V1/TnkController.cs @@ -12,9 +12,9 @@ using PARR.API.Controllers.V1.Base; using PARR.API.Extensions; using PARR.API.Services.Interfaces; using PARR.Constants; -using PARR.DAL.DomainModels; using PARR.DAL.Models; using PARR.DAL.Services.Interfaces; +using PARR.Domain.Common.Pagination; namespace PARR.API.Controllers.V1 { diff --git a/PARR.API/Controllers/V1/UnitController.cs b/PARR.API/Controllers/V1/UnitController.cs index d88cc661..b5b3e8fc 100644 --- a/PARR.API/Controllers/V1/UnitController.cs +++ b/PARR.API/Controllers/V1/UnitController.cs @@ -10,9 +10,9 @@ using PARR.API.Controllers.V1.Base; using PARR.API.Extensions; using PARR.BLL.Helpers; using PARR.Constants; -using PARR.DAL.DomainModels; using PARR.DAL.Models.Unit; using PARR.DAL.Services.Interfaces.Unit; +using PARR.Domain.Common.Pagination; namespace PARR.API.Controllers.V1 { diff --git a/PARR.API/Controllers/V1/UnitFieldValueController.cs b/PARR.API/Controllers/V1/UnitFieldValueController.cs index 7bf3032e..23be915f 100644 --- a/PARR.API/Controllers/V1/UnitFieldValueController.cs +++ b/PARR.API/Controllers/V1/UnitFieldValueController.cs @@ -10,9 +10,9 @@ using PARR.API.Controllers.V1.Base; using PARR.API.Extensions; using PARR.BLL.Helpers; using PARR.Constants; -using PARR.DAL.DomainModels; using PARR.DAL.Models.Unit; using PARR.DAL.Services.Interfaces.Unit; +using PARR.Domain.Common.Pagination; namespace PARR.API.Controllers.V1 { diff --git a/PARR.API/Controllers/V1/UserController.cs b/PARR.API/Controllers/V1/UserController.cs index 508914a4..fd0284a8 100644 --- a/PARR.API/Controllers/V1/UserController.cs +++ b/PARR.API/Controllers/V1/UserController.cs @@ -12,9 +12,9 @@ using PARR.API.Controllers.V1.Base; using PARR.API.Extensions; using PARR.API.Services.Interfaces; using PARR.Constants; -using PARR.DAL.DomainModels; using PARR.DAL.Models; using PARR.DAL.Services.Interfaces; +using PARR.Domain.Common.Pagination; namespace PARR.API.Controllers.V1 { diff --git a/PARR.API/Controllers/V1/WeekendController.cs b/PARR.API/Controllers/V1/WeekendController.cs index 9dd7fc35..46de7209 100644 --- a/PARR.API/Controllers/V1/WeekendController.cs +++ b/PARR.API/Controllers/V1/WeekendController.cs @@ -12,9 +12,9 @@ using PARR.API.Controllers.V1.Base; using PARR.API.Extensions; using PARR.API.Services.Interfaces; using PARR.Constants; -using PARR.DAL.DomainModels; using PARR.DAL.Models; using PARR.DAL.Services.Interfaces; +using PARR.Domain.Common.Pagination; namespace PARR.API.Controllers.V1 { diff --git a/PARR.API/Controllers/V1/WorkGroupController.cs b/PARR.API/Controllers/V1/WorkGroupController.cs index 009769d8..3ba7828c 100644 --- a/PARR.API/Controllers/V1/WorkGroupController.cs +++ b/PARR.API/Controllers/V1/WorkGroupController.cs @@ -10,9 +10,9 @@ using PARR.API.Controllers.V1.Base; using PARR.API.Extensions; using PARR.Constants; using PARR.DAL.Contracts; -using PARR.DAL.DomainModels; using PARR.DAL.Models; using PARR.DAL.Services.Interfaces; +using PARR.Domain.Common.Pagination; using PARR.Domain.Enums; namespace PARR.API.Controllers.V1 diff --git a/PARR.API/Extensions/PaginationExtensions.cs b/PARR.API/Extensions/PaginationExtensions.cs index e5130de0..ba3edd9f 100644 --- a/PARR.API/Extensions/PaginationExtensions.cs +++ b/PARR.API/Extensions/PaginationExtensions.cs @@ -1,5 +1,5 @@ using PARR.API.Contracts.V1.Responses.Base; -using PARR.DAL.DomainModels; +using PARR.Domain.Common.Pagination; namespace PARR.API.Extensions { diff --git a/PARR.API/MappingProfiles/RequestToDomainProfile.cs b/PARR.API/MappingProfiles/RequestToDomainProfile.cs index 3041bd9e..02f2c467 100644 --- a/PARR.API/MappingProfiles/RequestToDomainProfile.cs +++ b/PARR.API/MappingProfiles/RequestToDomainProfile.cs @@ -1,8 +1,8 @@ using AutoMapper; using PARR.API.Contracts.V1.Requests; using PARR.API.Contracts.V1.Requests.Queries; -using PARR.DAL.DomainModels; using PARR.DAL.Models.Job; +using PARR.Domain.Common.Pagination; namespace PARR.API.MappingProfiles { diff --git a/PARR.Core/PARR.Core.csproj b/PARR.Core/PARR.Core.csproj index 4535c00c..b74e94e8 100644 --- a/PARR.Core/PARR.Core.csproj +++ b/PARR.Core/PARR.Core.csproj @@ -10,7 +10,6 @@ - diff --git a/PARR.Core/Repositories/Base/IBaseRepository.cs b/PARR.Core/Repositories/Base/IBaseRepository.cs new file mode 100644 index 00000000..74cfce0c --- /dev/null +++ b/PARR.Core/Repositories/Base/IBaseRepository.cs @@ -0,0 +1,26 @@ +using PARR.Domain.Common.Pagination; +using PARR.Domain.Entities.Base; +using PARR.Domain.Entities.Base.History; + +namespace PARR.Core.Repositories.Base +{ + public interface IBaseRepository where T : class, IBaseEntity + { + Task GetAsync(Guid id); + + IQueryable Get(); + + IQueryable GetPage(IQueryable query, PaginationFilter paginationFilter); + + Task CreateAsync(T obj); + + Task AddRangeAsync(List objs); + + Task DeleteAsync(Guid id); + + bool Delete(T obj); + + //Task CommitAsync(); + Task CommitAsync(IHistoryInitiator? initiator = null); + } +} diff --git a/PARR.Core/Repositories/Interfaces/TaskRepositories/ITaskErrorRepository.cs b/PARR.Core/Repositories/Interfaces/TaskRepositories/ITaskErrorRepository.cs new file mode 100644 index 00000000..caf8889b --- /dev/null +++ b/PARR.Core/Repositories/Interfaces/TaskRepositories/ITaskErrorRepository.cs @@ -0,0 +1,9 @@ +using PARR.Core.Repositories.Base; +using PARR.Domain.Entities.TaskEntities; + +namespace PARR.Core.Repositories.Interfaces.TaskRepositories +{ + public interface ITaskErrorRepository : IBaseRepository + { + } +} diff --git a/PARR.Core/Repositories/Interfaces/TaskRepositories/ITaskRepository.cs b/PARR.Core/Repositories/Interfaces/TaskRepositories/ITaskRepository.cs new file mode 100644 index 00000000..af5c2bda --- /dev/null +++ b/PARR.Core/Repositories/Interfaces/TaskRepositories/ITaskRepository.cs @@ -0,0 +1,9 @@ +using PARR.Core.Repositories.Base; +using PARR.Domain.Entities.TaskEntities; + +namespace PARR.Core.Repositories.Interfaces.TaskRepositories +{ + public interface ITaskRepository : IBaseRepository + { + } +} diff --git a/PARR.Core/Repositories/Interfaces/TaskRepositories/ITaskTypeRepository.cs b/PARR.Core/Repositories/Interfaces/TaskRepositories/ITaskTypeRepository.cs new file mode 100644 index 00000000..3908bf45 --- /dev/null +++ b/PARR.Core/Repositories/Interfaces/TaskRepositories/ITaskTypeRepository.cs @@ -0,0 +1,9 @@ +using PARR.Domain.Entities.TaskEntities; + +namespace PARR.Core.Repositories.Interfaces.TaskRepositories +{ + public interface ITaskTypeRepository + { + IQueryable Get(); + } +} diff --git a/PARR.DAL/DomainModels/PaginationFilter.cs b/PARR.DAL/DomainModels/PaginationFilter.cs deleted file mode 100644 index 3f3f7820..00000000 --- a/PARR.DAL/DomainModels/PaginationFilter.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace PARR.DAL.DomainModels -{ - public class PaginationFilter - { - public int PageNumber { get; set; } - public int PageSize { get; set; } - - //public bool IsDisabledPagination { get; set; } - } -} diff --git a/PARR.DAL/Migrations/DataContextModelSnapshot.cs b/PARR.DAL/Migrations/DataContextModelSnapshot.cs index 56de1e10..29735453 100644 --- a/PARR.DAL/Migrations/DataContextModelSnapshot.cs +++ b/PARR.DAL/Migrations/DataContextModelSnapshot.cs @@ -51,7 +51,7 @@ namespace PARR.DAL.Migrations b.HasIndex("TemplateId"); - b.ToTable("AgentHistories"); + b.ToTable("AgentHistories", (string)null); }); modelBuilder.Entity("PARR.DAL.Models.AgentHistoryLevel", b => @@ -72,7 +72,7 @@ namespace PARR.DAL.Migrations b.HasKey("Id"); - b.ToTable("AgentHistoryLevels"); + b.ToTable("AgentHistoryLevels", (string)null); b.HasData( new @@ -101,7 +101,7 @@ namespace PARR.DAL.Migrations b.HasIndex("WorkGroupId"); - b.ToTable("AppInWorkInWorkGroups"); + b.ToTable("AppInWorkInWorkGroups", (string)null); }); modelBuilder.Entity("PARR.DAL.Models.Application", b => @@ -130,7 +130,7 @@ namespace PARR.DAL.Migrations b.HasIndex("Name", "ApplicationTypeId") .IsUnique(); - b.ToTable("Applications"); + b.ToTable("Applications", (string)null); }); modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b => @@ -157,7 +157,7 @@ namespace PARR.DAL.Migrations b.HasIndex("HostId"); - b.ToTable("ApplicationsInHost"); + b.ToTable("ApplicationsInHost", (string)null); }); modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b => @@ -181,7 +181,7 @@ namespace PARR.DAL.Migrations b.HasKey("Id"); - b.ToTable("ApplicationTypes"); + b.ToTable("ApplicationTypes", (string)null); b.HasData( new @@ -294,7 +294,7 @@ namespace PARR.DAL.Migrations b.HasIndex("WorkId", "ApplicationId") .IsUnique(); - b.ToTable("ApplicationsInWorks"); + b.ToTable("ApplicationsInWorks", (string)null); }); modelBuilder.Entity("PARR.DAL.Models.DistributionPeriod", b => @@ -397,7 +397,7 @@ namespace PARR.DAL.Migrations b.HasKey("Code"); - b.ToTable("EkStatuses"); + b.ToTable("EkStatuses", (string)null); b.HasData( new @@ -1516,7 +1516,7 @@ namespace PARR.DAL.Migrations b.HasIndex("WorkGroupId"); - b.ToTable("Hosts"); + b.ToTable("Hosts", (string)null); }); modelBuilder.Entity("PARR.DAL.Models.Job.Job", b => @@ -1912,7 +1912,7 @@ namespace PARR.DAL.Migrations b.HasIndex("TemplateId"); - b.ToTable("Orders"); + b.ToTable("Orders", (string)null); }); modelBuilder.Entity("PARR.DAL.Models.OrderStatus", b => @@ -1933,7 +1933,7 @@ namespace PARR.DAL.Migrations b.HasKey("Code"); - b.ToTable("OrderStatuses"); + b.ToTable("OrderStatuses", (string)null); b.HasData( new @@ -1986,7 +1986,7 @@ namespace PARR.DAL.Migrations b.HasIndex("Name") .IsUnique(); - b.ToTable("ParrComponents"); + b.ToTable("ParrComponents", (string)null); b.HasData( new @@ -2099,7 +2099,7 @@ namespace PARR.DAL.Migrations b.HasIndex("EsppId") .IsUnique(); - b.ToTable("Processes"); + b.ToTable("Processes", (string)null); }); modelBuilder.Entity("PARR.DAL.Models.ResponseArea", b => @@ -2116,7 +2116,7 @@ namespace PARR.DAL.Migrations b.HasKey("Code"); - b.ToTable("ResponseAreas"); + b.ToTable("ResponseAreas", (string)null); b.HasData( new @@ -2242,7 +2242,7 @@ namespace PARR.DAL.Migrations b.HasIndex("Name") .IsUnique(); - b.ToTable("Robots"); + b.ToTable("Robots", (string)null); b.HasData( new @@ -2301,7 +2301,7 @@ namespace PARR.DAL.Migrations b.HasIndex("TemplateId", "TaskStatusCode"); - b.ToTable("RobotConfigurations"); + b.ToTable("RobotConfigurations", (string)null); }); modelBuilder.Entity("PARR.DAL.Models.RobotHistory", b => @@ -2339,7 +2339,7 @@ namespace PARR.DAL.Migrations b.HasIndex("TaskStatusCode"); - b.ToTable("RobotHistories"); + b.ToTable("RobotHistories", (string)null); }); modelBuilder.Entity("PARR.DAL.Models.RobotHistoryLevel", b => @@ -2360,7 +2360,7 @@ namespace PARR.DAL.Migrations b.HasKey("Level"); - b.ToTable("RobotHistoryLevels"); + b.ToTable("RobotHistoryLevels", (string)null); b.HasData( new @@ -2407,7 +2407,7 @@ namespace PARR.DAL.Migrations b.HasKey("Code"); - b.ToTable("RobotStatuses"); + b.ToTable("RobotStatuses", (string)null); b.HasData( new @@ -2455,7 +2455,7 @@ namespace PARR.DAL.Migrations b.HasKey("Id"); - b.ToTable("Roles"); + b.ToTable("Roles", (string)null); b.HasData( new @@ -2624,7 +2624,7 @@ namespace PARR.DAL.Migrations b.HasKey("Name"); - b.ToTable("Settings"); + b.ToTable("Settings", (string)null); b.HasData( new @@ -2748,7 +2748,7 @@ namespace PARR.DAL.Migrations b.HasIndex("ProcessId"); - b.ToTable("Subprocesses"); + b.ToTable("Subprocesses", (string)null); }); modelBuilder.Entity("PARR.DAL.Models.TaskModels.TaskError", b => @@ -2941,7 +2941,7 @@ namespace PARR.DAL.Migrations b.HasKey("Code"); - b.ToTable("TaskStatuses"); + b.ToTable("TaskStatuses", (string)null); b.HasData( new @@ -3027,7 +3027,7 @@ namespace PARR.DAL.Migrations b.HasIndex("Name", "Index") .IsUnique(); - b.ToTable("Templates"); + b.ToTable("Templates", (string)null); }); modelBuilder.Entity("PARR.DAL.Models.TemplateHistory", b => @@ -3080,7 +3080,7 @@ namespace PARR.DAL.Migrations b.HasIndex("ParentId"); - b.ToTable("TemplateHistories"); + b.ToTable("TemplateHistories", (string)null); }); modelBuilder.Entity("PARR.DAL.Models.TemplateStatusType", b => @@ -3098,7 +3098,7 @@ namespace PARR.DAL.Migrations b.HasKey("Id"); - b.ToTable("TemplateStatusTypes", t => + b.ToTable("TemplateStatusTypes", null, t => { t.HasComment("Таблица описания критериев выборки аттрибутов ЭК"); }); @@ -3159,7 +3159,7 @@ namespace PARR.DAL.Migrations b.HasIndex("SubprocessId"); - b.ToTable("Tnks"); + b.ToTable("Tnks", (string)null); }); modelBuilder.Entity("PARR.DAL.Models.Unit.Unit", b => @@ -3425,7 +3425,7 @@ namespace PARR.DAL.Migrations b.HasIndex("Ip") .IsUnique(); - b.ToTable("Users"); + b.ToTable("Users", (string)null); }); modelBuilder.Entity("PARR.DAL.Models.UsersInRole", b => @@ -3440,7 +3440,7 @@ namespace PARR.DAL.Migrations b.HasIndex("UserId"); - b.ToTable("UsersInRoles"); + b.ToTable("UsersInRoles", (string)null); }); modelBuilder.Entity("PARR.DAL.Models.WeekendDay", b => @@ -3480,7 +3480,7 @@ namespace PARR.DAL.Migrations b.HasIndex("ResponseAreaCode"); - b.ToTable("WorkGroups"); + b.ToTable("WorkGroups", (string)null); }); modelBuilder.Entity("PARR.DAL.Models.AgentHistory", b => diff --git a/PARR.DAL/PARR.DAL.csproj b/PARR.DAL/PARR.DAL.csproj index efb38964..20341eba 100644 --- a/PARR.DAL/PARR.DAL.csproj +++ b/PARR.DAL/PARR.DAL.csproj @@ -26,8 +26,4 @@ - - - - diff --git a/PARR.DAL/ParrDalInstaller.cs b/PARR.DAL/ParrDalInstaller.cs index 727814eb..967fcedf 100644 --- a/PARR.DAL/ParrDalInstaller.cs +++ b/PARR.DAL/ParrDalInstaller.cs @@ -2,6 +2,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using PARR.Core.Repositories.Interfaces.TaskRepositories; using PARR.DAL.Cache.Services.Base; using PARR.DAL.Configurations.DbSettings; using PARR.DAL.Context; @@ -14,16 +15,15 @@ using PARR.DAL.DomainServices.UnitFilterService.Models; using PARR.DAL.InfluxDbServices; using PARR.DAL.NextRunServices; using PARR.DAL.NextRunServices.Subservices; +using PARR.DAL.Repositories.TaskRepositories; using PARR.DAL.Services.Implementation; using PARR.DAL.Services.Implementations; using PARR.DAL.Services.Implementations.Job; using PARR.DAL.Services.Implementations.Schedule; -using PARR.DAL.Services.Implementations.TaskServices; using PARR.DAL.Services.Implementations.Unit; using PARR.DAL.Services.Interfaces; using PARR.DAL.Services.Interfaces.Job; using PARR.DAL.Services.Interfaces.Schedule; -using PARR.DAL.Services.Interfaces.TaskServices; using PARR.DAL.Services.Interfaces.Unit; using PARR.DAL.Settings; using PARR.DAL.TaskServices; @@ -154,9 +154,9 @@ namespace PARR.DAL #region Task - services.AddTransient(); - services.AddTransient(); - services.AddTransient(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); services.AddTransient(); diff --git a/PARR.DAL/Services/Abstracts/BaseService.cs b/PARR.DAL/Repositories/Base/BaseRepository.cs similarity index 93% rename from PARR.DAL/Services/Abstracts/BaseService.cs rename to PARR.DAL/Repositories/Base/BaseRepository.cs index 0bd9f774..32e213a8 100644 --- a/PARR.DAL/Services/Abstracts/BaseService.cs +++ b/PARR.DAL/Repositories/Base/BaseRepository.cs @@ -1,28 +1,40 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.Extensions.Logging; +using PARR.Core.Repositories.Base; using PARR.DAL.Context; -using PARR.DAL.DomainModels; -using PARR.DAL.Services.Interfaces.Base; +using PARR.Domain.Common.Pagination; 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 +namespace PARR.DAL.Repositories.Base { - internal abstract class BaseService : IBaseService where T : class, IBaseEntity + internal abstract class BaseRepository : IBaseRepository where T : class, IBaseEntity { - private readonly ILogger> logger; + //private readonly ILogger> logger; - protected abstract DbSet EntitySet { get; } - protected abstract DataContext EntitiContext { get; } + //protected abstract DbSet EntitySet { get; } + //protected abstract DataContext EntitiContext { get; } - public BaseService(ILogger> logger) + //public BaseRepository(ILogger> logger) + //{ + // this.logger = logger; + //} + + protected readonly ILogger logger; + protected readonly DbSet EntitySet; + protected readonly DataContext EntityContext; + + protected BaseRepository(ILogger logger, DataContext dataContext) { this.logger = logger; + this.EntityContext = dataContext; + this.EntitySet = dataContext.Set(); } + public virtual async Task AddRangeAsync(List objs) { logger.LogDebug("Начинаю добавление диапазона объектов типа {EntityType}, количество: {Count}", @@ -49,7 +61,7 @@ namespace PARR.DAL.Services.Abstracts logger.LogDebug("Начинаю сохранение изменений в БД для объектов типа {EntityType}", typeof(T).Name); #region Изменения - var modifiedEntrities = EntitiContext.ChangeTracker.Entries() + var modifiedEntrities = EntityContext.ChangeTracker.Entries() .Where(t => t.State == EntityState.Modified/* || t.State == EntityState.Deleted*/); logger.LogDebug("Найдено {Count} измененных сущностей для обработки истории", modifiedEntrities.Count()); @@ -68,7 +80,7 @@ namespace PARR.DAL.Services.Abstracts try { - var changedCount = await EntitiContext.SaveChangesAsync(); + var changedCount = await EntityContext.SaveChangesAsync(); logger.LogDebug("Успешно сохранено {ChangedCount} изменений в БД для объектов типа {EntityType}", changedCount, typeof(T).Name); return true; @@ -90,7 +102,7 @@ namespace PARR.DAL.Services.Abstracts logger.LogDebug("Устанавливаю инициатора для изменений"); // Задаем инициатора только для новых и измененных записей - var entrities = EntitiContext.ChangeTracker.Entries() + var entrities = EntityContext.ChangeTracker.Entries() .Where(t => t.State == EntityState.Modified || t.State == EntityState.Added); var entityCount = entrities.Count(); @@ -172,7 +184,7 @@ namespace PARR.DAL.Services.Abstracts try { - EntitiContext.Add(historyInstance); + EntityContext.Add(historyInstance); logger.LogDebug("История добавлена для сущности типа {EntityType}", obj.Entity.GetType().Name); } catch (Exception ex) diff --git a/PARR.DAL/Repositories/TaskRepositories/TaskErrorRepository.cs b/PARR.DAL/Repositories/TaskRepositories/TaskErrorRepository.cs new file mode 100644 index 00000000..a817d532 --- /dev/null +++ b/PARR.DAL/Repositories/TaskRepositories/TaskErrorRepository.cs @@ -0,0 +1,13 @@ +using Microsoft.Extensions.Logging; +using PARR.Core.Repositories.Interfaces.TaskRepositories; +using PARR.DAL.Context; +using PARR.DAL.Repositories.Base; +using PARR.Domain.Entities.TaskEntities; + +namespace PARR.DAL.Repositories.TaskRepositories +{ + internal class TaskErrorRepository : BaseRepository, ITaskErrorRepository + { + public TaskErrorRepository(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } + } +} diff --git a/PARR.DAL/Repositories/TaskRepositories/TaskRepository.cs b/PARR.DAL/Repositories/TaskRepositories/TaskRepository.cs new file mode 100644 index 00000000..142983dc --- /dev/null +++ b/PARR.DAL/Repositories/TaskRepositories/TaskRepository.cs @@ -0,0 +1,16 @@ +using Microsoft.Extensions.Logging; +using PARR.Core.Repositories.Interfaces.TaskRepositories; +using PARR.DAL.Context; +using PARR.DAL.Repositories.Base; +using PARR.Domain.Entities.TaskEntities; + +namespace PARR.DAL.Repositories.TaskRepositories +{ + internal class TaskRepository : BaseRepository, ITaskRepository + { + public TaskRepository(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } + + + // метод атомарного взятия в работу + } +} diff --git a/PARR.DAL/Services/Implementations/TaskServices/TaskTypeService.cs b/PARR.DAL/Repositories/TaskRepositories/TaskTypeRepository.cs similarity index 52% rename from PARR.DAL/Services/Implementations/TaskServices/TaskTypeService.cs rename to PARR.DAL/Repositories/TaskRepositories/TaskTypeRepository.cs index 66edd45a..9250424c 100644 --- a/PARR.DAL/Services/Implementations/TaskServices/TaskTypeService.cs +++ b/PARR.DAL/Repositories/TaskRepositories/TaskTypeRepository.cs @@ -1,14 +1,14 @@ -using PARR.DAL.Context; -using PARR.DAL.Services.Interfaces.TaskServices; +using PARR.Core.Repositories.Interfaces.TaskRepositories; +using PARR.DAL.Context; using PARR.Domain.Entities.TaskEntities; -namespace PARR.DAL.Services.Implementations.TaskServices +namespace PARR.DAL.Repositories.TaskRepositories { - internal class TaskTypeService : ITaskTypeService + internal class TaskTypeRepository : ITaskTypeRepository { private readonly DataContext dataContext; - public TaskTypeService(DataContext dataContext) + public TaskTypeRepository(DataContext dataContext) { this.dataContext = dataContext; } diff --git a/PARR.DAL/Services/Implementations/AgentHistoryService.cs b/PARR.DAL/Services/Implementations/AgentHistoryService.cs index 439d18e2..6dd7f6ba 100644 --- a/PARR.DAL/Services/Implementations/AgentHistoryService.cs +++ b/PARR.DAL/Services/Implementations/AgentHistoryService.cs @@ -1,23 +1,14 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.Models; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces; namespace PARR.DAL.Services.Implementations { - internal class AgentHistoryService : BaseService, IAgentHistoryService + internal class AgentHistoryService : BaseRepository, IAgentHistoryService { - private readonly DataContext dataContext; + public AgentHistoryService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } - public AgentHistoryService(DataContext dataContext, ILogger logger) : base(logger) - { - this.dataContext = dataContext; - } - - protected override DbSet EntitySet => dataContext.AgentHistories; - - protected override DataContext EntitiContext => dataContext; } } diff --git a/PARR.DAL/Services/Implementations/ApplicationInHostService.cs b/PARR.DAL/Services/Implementations/ApplicationInHostService.cs index 52d87dd1..6702e347 100644 --- a/PARR.DAL/Services/Implementations/ApplicationInHostService.cs +++ b/PARR.DAL/Services/Implementations/ApplicationInHostService.cs @@ -1,25 +1,14 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.Models; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces; namespace PARR.DAL.Services.Implementations { - internal class ApplicationInHostService : BaseService, IApplicationInHostService + internal class ApplicationInHostService : BaseRepository, IApplicationInHostService { - private readonly DataContext dataContext; - private readonly ILogger logger; + public ApplicationInHostService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } - public ApplicationInHostService(DataContext dataContext, ILogger logger) : base(logger) - { - this.dataContext = dataContext; - this.logger = logger; - } - - protected override DbSet EntitySet => dataContext.ApplicationsInHosts; - - protected override DataContext EntitiContext => dataContext; } } diff --git a/PARR.DAL/Services/Implementations/ApplicationService.cs b/PARR.DAL/Services/Implementations/ApplicationService.cs index 543fb00d..e0899ff4 100644 --- a/PARR.DAL/Services/Implementations/ApplicationService.cs +++ b/PARR.DAL/Services/Implementations/ApplicationService.cs @@ -2,25 +2,14 @@ using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.Models; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces; namespace PARR.DAL.Services.Implementations { - internal class ApplicationService : BaseService, IApplicationService + internal class ApplicationService : BaseRepository, IApplicationService { - private readonly DataContext dataContext; - private readonly ILogger logger; - - public ApplicationService(DataContext dataContext, ILogger logger) : base(logger) - { - this.dataContext = dataContext; - this.logger = logger; - } - - protected override DbSet EntitySet => dataContext.Applications; - - protected override DataContext EntitiContext => dataContext; + public ApplicationService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } public async Task GetByNameAsync(string appName, Guid typeId) { diff --git a/PARR.DAL/Services/Implementations/ApplicationTypeService.cs b/PARR.DAL/Services/Implementations/ApplicationTypeService.cs index 552f176d..0fc21c39 100644 --- a/PARR.DAL/Services/Implementations/ApplicationTypeService.cs +++ b/PARR.DAL/Services/Implementations/ApplicationTypeService.cs @@ -1,25 +1,14 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.Models; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces; namespace PARR.DAL.Services.Implementation { - internal class ApplicationTypeService : BaseService, IApplicationTypeService + internal class ApplicationTypeService : BaseRepository, IApplicationTypeService { - private readonly DataContext dataContext; - private readonly ILogger logger; + public ApplicationTypeService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } - public ApplicationTypeService(DataContext dataContext, ILogger logger) : base(logger) - { - this.dataContext = dataContext; - this.logger = logger; - } - - protected override DbSet EntitySet => dataContext.ApplicationTypes; - - protected override DataContext EntitiContext => dataContext; } } diff --git a/PARR.DAL/Services/Implementations/ApplicationsInWorkService.cs b/PARR.DAL/Services/Implementations/ApplicationsInWorkService.cs index 46786906..4dd732ec 100644 --- a/PARR.DAL/Services/Implementations/ApplicationsInWorkService.cs +++ b/PARR.DAL/Services/Implementations/ApplicationsInWorkService.cs @@ -2,26 +2,14 @@ using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.Models; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces; namespace PARR.DAL.Services.Implementations { - internal class ApplicationsInWorkService : BaseService, IApplicationsInWorkService + internal class ApplicationsInWorkService : BaseRepository, IApplicationsInWorkService { - private readonly DataContext dataContext; - private readonly ILogger logger; - - public ApplicationsInWorkService(DataContext dataContext, ILogger logger) : base(logger) - { - this.dataContext = dataContext; - this.logger = logger; - } - - - protected override DbSet EntitySet => dataContext.ApplicationsInWorks; - - protected override DataContext EntitiContext => dataContext; + public ApplicationsInWorkService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } public async Task GetAsync(Guid applicationId, Guid workId) { diff --git a/PARR.DAL/Services/Implementations/DistributionPeriodService.cs b/PARR.DAL/Services/Implementations/DistributionPeriodService.cs index 68baa6ac..b1f8a7f0 100644 --- a/PARR.DAL/Services/Implementations/DistributionPeriodService.cs +++ b/PARR.DAL/Services/Implementations/DistributionPeriodService.cs @@ -1,23 +1,13 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.Models; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces; namespace PARR.DAL.Services.Implementations { - internal class DistributionPeriodService : BaseService, IDistributionPeriodService + internal class DistributionPeriodService : BaseRepository, IDistributionPeriodService { - private readonly DataContext dataContext; - - protected override DbSet EntitySet => dataContext.DistributionPeriods; - - protected override DataContext EntitiContext => dataContext; - - public DistributionPeriodService(DataContext dataContext, ILogger logger) : base(logger) - { - this.dataContext = dataContext; - } + public DistributionPeriodService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } } } diff --git a/PARR.DAL/Services/Implementations/EsppSchTypeConfigService.cs b/PARR.DAL/Services/Implementations/EsppSchTypeConfigService.cs index 0716c4c9..068adb4b 100644 --- a/PARR.DAL/Services/Implementations/EsppSchTypeConfigService.cs +++ b/PARR.DAL/Services/Implementations/EsppSchTypeConfigService.cs @@ -3,23 +3,14 @@ using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.DomainModels; using PARR.DAL.Models; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces; namespace PARR.DAL.Services.Implementations { - internal class EsppSchTypeConfigService : BaseService, IEsppSchTypeConfigService + internal class EsppSchTypeConfigService : BaseRepository, IEsppSchTypeConfigService { - private readonly DataContext dataContext; - - public EsppSchTypeConfigService(DataContext dataContext, ILogger logger) : base(logger) - { - this.dataContext = dataContext; - } - - protected override DbSet EntitySet => dataContext.EsppSchTypeConfigs; - - protected override DataContext EntitiContext => dataContext; + public EsppSchTypeConfigService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } public IQueryable GetWithSchIncludes() { @@ -36,7 +27,7 @@ namespace PARR.DAL.Services.Implementations { //Формирует расписание в нормальном понятном виде из БД - var items = await dataContext.EsppSchValues.Where(t => t.JobGroupId == jobGroupId) + var items = await EntityContext.EsppSchValues.Where(t => t.JobGroupId == jobGroupId) .Select(t => new { t.EsppSchTypeConfig!.Order, diff --git a/PARR.DAL/Services/Implementations/EsppSchTypeValueService.cs b/PARR.DAL/Services/Implementations/EsppSchTypeValueService.cs index cd177f68..cc2bb6e4 100644 --- a/PARR.DAL/Services/Implementations/EsppSchTypeValueService.cs +++ b/PARR.DAL/Services/Implementations/EsppSchTypeValueService.cs @@ -1,23 +1,13 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.Models; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces; namespace PARR.DAL.Services.Implementations { - internal class EsppSchTypeValueService : BaseService, IEsppSchTypeValueService + internal class EsppSchTypeValueService : BaseRepository, IEsppSchTypeValueService { - private readonly DataContext dataContext; - - protected override DbSet EntitySet => dataContext.EsppSchTypeValues; - - protected override DataContext EntitiContext => dataContext; - - public EsppSchTypeValueService(DataContext dataContext, ILogger logger): base(logger) - { - this.dataContext = dataContext; - } + public EsppSchTypeValueService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } } } diff --git a/PARR.DAL/Services/Implementations/HostService.cs b/PARR.DAL/Services/Implementations/HostService.cs index 782fd6df..779db43b 100644 --- a/PARR.DAL/Services/Implementations/HostService.cs +++ b/PARR.DAL/Services/Implementations/HostService.cs @@ -2,24 +2,14 @@ using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.Models; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces; namespace PARR.DAL.Services.Implementations { - internal class HostService : BaseService, IHostService + internal class HostService : BaseRepository, IHostService { - private readonly DataContext dataContext; - private readonly ILogger logger; - - protected override DbSet EntitySet => dataContext.Hosts; - - protected override DataContext EntitiContext => dataContext; - public HostService(DataContext dataContext, ILogger logger) : base(logger) - { - this.dataContext = dataContext; - this.logger = logger; - } + public HostService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } public async Task GetHostWithAppsByIpAsync(string ip) diff --git a/PARR.DAL/Services/Implementations/Job/FieldFilterService.cs b/PARR.DAL/Services/Implementations/Job/FieldFilterService.cs index 5287a28e..3824af98 100644 --- a/PARR.DAL/Services/Implementations/Job/FieldFilterService.cs +++ b/PARR.DAL/Services/Implementations/Job/FieldFilterService.cs @@ -1,21 +1,12 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using PARR.DAL.Context; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces.Job; namespace PARR.DAL.Services.Implementations.Job { - internal class FieldFilterService : BaseService, IFieldFilterService + internal class FieldFilterService : BaseRepository, IFieldFilterService { - private readonly DataContext dataContext; - - protected override DbSet EntitySet => dataContext.FieldFilters; - - protected override DataContext EntitiContext => dataContext; - public FieldFilterService(DataContext dataContext, ILogger logger) : base(logger) - { - this.dataContext = dataContext; - } + public FieldFilterService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } } } diff --git a/PARR.DAL/Services/Implementations/Job/JobDetailsService.cs b/PARR.DAL/Services/Implementations/Job/JobDetailsService.cs index 2e395a3c..96cac52a 100644 --- a/PARR.DAL/Services/Implementations/Job/JobDetailsService.cs +++ b/PARR.DAL/Services/Implementations/Job/JobDetailsService.cs @@ -1,23 +1,13 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.Models.Job; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces.Job; namespace PARR.DAL.Services.Implementations.Job { - internal class JobUnitFilterService : BaseService, IJobUnitFilterService + internal class JobUnitFilterService : BaseRepository, IJobUnitFilterService { - private readonly DataContext dataContext; - - protected override DbSet EntitySet => dataContext.JobUnitFilters; - - protected override DataContext EntitiContext => dataContext; - - public JobUnitFilterService(DataContext dataContext, ILogger logger) : base(logger) - { - this.dataContext = dataContext; - } + public JobUnitFilterService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } } } diff --git a/PARR.DAL/Services/Implementations/Job/JobGroupService.cs b/PARR.DAL/Services/Implementations/Job/JobGroupService.cs index c6b4ef97..8aaadf88 100644 --- a/PARR.DAL/Services/Implementations/Job/JobGroupService.cs +++ b/PARR.DAL/Services/Implementations/Job/JobGroupService.cs @@ -1,28 +1,19 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.Models.Job; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces.Job; namespace PARR.DAL.Services.Implementations.Job { - internal class JobGroupService : BaseService, IJobGroupService + internal class JobGroupService : BaseRepository, IJobGroupService { - private readonly DataContext dataContext; - - public JobGroupService(DataContext dataContext, ILogger logger) : base(logger) - { - this.dataContext = dataContext; - } - protected override DbSet EntitySet => dataContext.JobGroups; - - protected override DataContext EntitiContext => dataContext; + public JobGroupService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } public void DeleteDistributionConfig(JobGroupDistributionConfig distributionConfig) { - EntitiContext.JobGroupDistributionConfigs.Remove(distributionConfig); + EntityContext.JobGroupDistributionConfigs.Remove(distributionConfig); } } } diff --git a/PARR.DAL/Services/Implementations/Job/JobGroupTypeService.cs b/PARR.DAL/Services/Implementations/Job/JobGroupTypeService.cs index 4f170497..a2984fc4 100644 --- a/PARR.DAL/Services/Implementations/Job/JobGroupTypeService.cs +++ b/PARR.DAL/Services/Implementations/Job/JobGroupTypeService.cs @@ -1,27 +1,13 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.Models.Job; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces.Job; namespace PARR.DAL.Services.Implementations.Job { - internal class JobGroupTypeService : BaseService, IJobGroupTypeService + internal class JobGroupTypeService : BaseRepository, IJobGroupTypeService { - private readonly DataContext dataContext; - private readonly ILogger logger; - - protected override DbSet EntitySet => dataContext.JobGroupTypes; - - protected override DataContext EntitiContext => dataContext; - public JobGroupTypeService( - DataContext dataContext, - ILogger logger - ) : base(logger) - { - this.dataContext = dataContext; - this.logger = logger; - } + public JobGroupTypeService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } } } diff --git a/PARR.DAL/Services/Implementations/Job/JobService.cs b/PARR.DAL/Services/Implementations/Job/JobService.cs index 1c420e16..d34319cd 100644 --- a/PARR.DAL/Services/Implementations/Job/JobService.cs +++ b/PARR.DAL/Services/Implementations/Job/JobService.cs @@ -1,23 +1,13 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using PARR.DAL.Context; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces.Job; namespace PARR.DAL.Services.Implementations.Job { - internal class JobService : BaseService, IJobService + internal class JobService : BaseRepository, IJobService { - private readonly DataContext dataContext; - - public JobService(DataContext dataContext, ILogger logger) : base(logger) - { - this.dataContext = dataContext; - } - - protected override DbSet EntitySet => dataContext.Jobs; - - protected override DataContext EntitiContext => dataContext; + public JobService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } public override Task CreateAsync(Models.Job.Job obj) { diff --git a/PARR.DAL/Services/Implementations/OrderService.cs b/PARR.DAL/Services/Implementations/OrderService.cs index 45a17e80..7748f52a 100644 --- a/PARR.DAL/Services/Implementations/OrderService.cs +++ b/PARR.DAL/Services/Implementations/OrderService.cs @@ -1,23 +1,13 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.Models; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces; namespace PARR.DAL.Services.Implementations { - internal class OrderService : BaseService, IOrderService + internal class OrderService : BaseRepository, IOrderService { - private readonly DataContext dataContext; - - public OrderService(DataContext dataContext, ILogger logger) : base(logger) - { - this.dataContext = dataContext; - } - - protected override DbSet EntitySet => dataContext.Orders; - - protected override DataContext EntitiContext => dataContext; + public OrderService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } } } \ No newline at end of file diff --git a/PARR.DAL/Services/Implementations/ProcessService.cs b/PARR.DAL/Services/Implementations/ProcessService.cs index c6c512ee..f1e87986 100644 --- a/PARR.DAL/Services/Implementations/ProcessService.cs +++ b/PARR.DAL/Services/Implementations/ProcessService.cs @@ -1,24 +1,14 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.Models; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces; namespace PARR.DAL.Services.Implementations { - internal class ProcessService : BaseService, IProcessService + internal class ProcessService : BaseRepository, IProcessService { - private readonly ILogger logger; - private readonly DataContext dataContext; + public ProcessService(ILogger logger, DataContext dataContext) : base(logger, dataContext) { } - public ProcessService(ILogger logger, DataContext dataContext) : base(logger) - { - this.logger = logger; - this.dataContext = dataContext; - } - protected override DbSet EntitySet => dataContext.Processes; - - protected override DataContext EntitiContext => dataContext; } } diff --git a/PARR.DAL/Services/Implementations/RobotConfigurationService.cs b/PARR.DAL/Services/Implementations/RobotConfigurationService.cs index 38005857..cf8fd8d1 100644 --- a/PARR.DAL/Services/Implementations/RobotConfigurationService.cs +++ b/PARR.DAL/Services/Implementations/RobotConfigurationService.cs @@ -3,26 +3,15 @@ using Microsoft.Extensions.Logging; 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.Enums; namespace PARR.DAL.Services.Implementations { - internal class RobotConfigurationService : BaseService, IRobotConfigurationService + internal class RobotConfigurationService : BaseRepository, IRobotConfigurationService { - private readonly DataContext dataContext; - private readonly ILogger logger; - - public RobotConfigurationService(DataContext dataContext, ILogger logger) : base(logger) - { - this.dataContext = dataContext; - this.logger = logger; - } - - protected override DbSet EntitySet => dataContext.RobotConfigurations; - - protected override DataContext EntitiContext => dataContext; + public RobotConfigurationService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } public void ChangeTaskStatus(TaskStatusEnum taskStatus, RobotConfiguration configuration) diff --git a/PARR.DAL/Services/Implementations/RobotHistoryService.cs b/PARR.DAL/Services/Implementations/RobotHistoryService.cs index ef7892ea..f6f1cba2 100644 --- a/PARR.DAL/Services/Implementations/RobotHistoryService.cs +++ b/PARR.DAL/Services/Implementations/RobotHistoryService.cs @@ -1,23 +1,14 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.Models; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces; namespace PARR.DAL.Services.Implementations { - internal class RobotHistoryService : BaseService, IRobotHistoryService + internal class RobotHistoryService : BaseRepository, IRobotHistoryService { - private readonly DataContext dataContext; + public RobotHistoryService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } - public RobotHistoryService(DataContext dataContext, ILogger logger) : base(logger) - { - this.dataContext = dataContext; - } - - protected override DbSet EntitySet => dataContext.RobotHistories; - - protected override DataContext EntitiContext => dataContext; } } diff --git a/PARR.DAL/Services/Implementations/RoleService.cs b/PARR.DAL/Services/Implementations/RoleService.cs index 738d1f46..33c3bfe8 100644 --- a/PARR.DAL/Services/Implementations/RoleService.cs +++ b/PARR.DAL/Services/Implementations/RoleService.cs @@ -1,23 +1,13 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.Models; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces; namespace PARR.DAL.Services.Implementations { - internal class RoleService : BaseService, IRoleService + internal class RoleService : BaseRepository, IRoleService { - private readonly DataContext dataContext; - - public RoleService(DataContext dataContext, ILogger logger) : base(logger) - { - this.dataContext = dataContext; - } - - protected override DbSet EntitySet => dataContext.Roles; - - protected override DataContext EntitiContext => dataContext; + public RoleService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } } } diff --git a/PARR.DAL/Services/Implementations/Schedule/ScheduleExcludeTypeCalendarService.cs b/PARR.DAL/Services/Implementations/Schedule/ScheduleExcludeTypeCalendarService.cs index 2c0f1fe5..5e97406a 100644 --- a/PARR.DAL/Services/Implementations/Schedule/ScheduleExcludeTypeCalendarService.cs +++ b/PARR.DAL/Services/Implementations/Schedule/ScheduleExcludeTypeCalendarService.cs @@ -1,23 +1,13 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.Models.Schedule; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces.Schedule; namespace PARR.DAL.Services.Implementations.Schedule { - internal class ScheduleExcludeTypeCalendarService : BaseService, IScheduleExcludeTypeCalendarService + internal class ScheduleExcludeTypeCalendarService : BaseRepository, IScheduleExcludeTypeCalendarService { - private readonly DataContext dataContext; - - protected override DbSet EntitySet => dataContext.ScheduleExcludeTypeCalendars; - - protected override DataContext EntitiContext => dataContext; - - public ScheduleExcludeTypeCalendarService(DataContext dataContext, ILogger logger) : base(logger) - { - this.dataContext = dataContext; - } + public ScheduleExcludeTypeCalendarService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } } } diff --git a/PARR.DAL/Services/Implementations/Schedule/ScheduleExcludeTypeService.cs b/PARR.DAL/Services/Implementations/Schedule/ScheduleExcludeTypeService.cs index 5272305d..e8337497 100644 --- a/PARR.DAL/Services/Implementations/Schedule/ScheduleExcludeTypeService.cs +++ b/PARR.DAL/Services/Implementations/Schedule/ScheduleExcludeTypeService.cs @@ -1,23 +1,13 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.Models.Schedule; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces.Schedule; namespace PARR.DAL.Services.Implementations.Schedule { - internal class ScheduleExcludeTypeService : BaseService, IScheduleExcludeTypeService + internal class ScheduleExcludeTypeService : BaseRepository, IScheduleExcludeTypeService { - private readonly DataContext dataContext; - - protected override DbSet EntitySet => dataContext.ScheduleExcludeTypes; - - protected override DataContext EntitiContext => dataContext; - - public ScheduleExcludeTypeService(DataContext dataContext, ILogger logger) : base(logger) - { - this.dataContext = dataContext; - } + public ScheduleExcludeTypeService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } } } diff --git a/PARR.DAL/Services/Implementations/Schedule/ScheduleResponseAreaTimeOffsetService.cs b/PARR.DAL/Services/Implementations/Schedule/ScheduleResponseAreaTimeOffsetService.cs index 8a05b428..3606aa20 100644 --- a/PARR.DAL/Services/Implementations/Schedule/ScheduleResponseAreaTimeOffsetService.cs +++ b/PARR.DAL/Services/Implementations/Schedule/ScheduleResponseAreaTimeOffsetService.cs @@ -10,10 +10,12 @@ namespace PARR.DAL.Services.Implementations.Schedule internal sealed class ScheduleResponseAreaTimeOffsetService : IScheduleResponseAreaTimeOffsetService { private readonly IReadOnlyDictionary offsetList; + /// /// ЗО по умолчанию /// private readonly string defaultResponseArea; + /// /// Настройки, если не нашли в offsetList /// diff --git a/PARR.DAL/Services/Implementations/SubprocessService.cs b/PARR.DAL/Services/Implementations/SubprocessService.cs index 2f042652..6e67c680 100644 --- a/PARR.DAL/Services/Implementations/SubprocessService.cs +++ b/PARR.DAL/Services/Implementations/SubprocessService.cs @@ -1,24 +1,14 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.Models; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces; namespace PARR.DAL.Services.Implementations { - internal class SubprocessService : BaseService, ISubprocessService + internal class SubprocessService : BaseRepository, ISubprocessService { - private readonly ILogger logger; - private readonly DataContext dataContext; + public SubprocessService(ILogger logger, DataContext dataContext) : base(logger, dataContext) { } - public SubprocessService(ILogger logger, DataContext dataContext) : base(logger) - { - this.logger = logger; - this.dataContext = dataContext; - } - protected override DbSet EntitySet => dataContext.Subprocesses; - - protected override DataContext EntitiContext => dataContext; } } diff --git a/PARR.DAL/Services/Implementations/TaskServices/TaskErrorService.cs b/PARR.DAL/Services/Implementations/TaskServices/TaskErrorService.cs deleted file mode 100644 index 7bf5d548..00000000 --- a/PARR.DAL/Services/Implementations/TaskServices/TaskErrorService.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; -using PARR.DAL.Context; -using PARR.DAL.Services.Abstracts; -using PARR.DAL.Services.Interfaces.TaskServices; -using PARR.Domain.Entities.TaskEntities; - -namespace PARR.DAL.Services.Implementations.TaskServices -{ - internal class TaskErrorService : BaseService, ITaskErrorService - { - private readonly DataContext dataContext; - - protected override DbSet EntitySet => dataContext.TaskErrors; - - protected override DataContext EntitiContext => dataContext; - - public TaskErrorService(DataContext dataContext, ILogger logger): base(logger) - { - this.dataContext = dataContext; - } - } -} diff --git a/PARR.DAL/Services/Implementations/TaskServices/TaskService.cs b/PARR.DAL/Services/Implementations/TaskServices/TaskService.cs deleted file mode 100644 index 4b7bd134..00000000 --- a/PARR.DAL/Services/Implementations/TaskServices/TaskService.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; -using PARR.DAL.Context; -using PARR.DAL.Services.Abstracts; -using PARR.DAL.Services.Interfaces.TaskServices; -using PARR.Domain.Entities.TaskEntities; - -namespace PARR.DAL.Services.Implementations.TaskServices -{ - internal class TaskService : BaseService, ITaskService - { - private readonly DataContext dataContext; - - protected override DbSet EntitySet => dataContext.Tasks; - - protected override DataContext EntitiContext => dataContext; - - public TaskService(DataContext dataContext, ILogger logger) : base(logger) - { - this.dataContext = dataContext; - } - - - // метод атомарного взятия в работу - } -} diff --git a/PARR.DAL/Services/Implementations/TemplateHistoryService.cs b/PARR.DAL/Services/Implementations/TemplateHistoryService.cs index 8167926f..1e79becc 100644 --- a/PARR.DAL/Services/Implementations/TemplateHistoryService.cs +++ b/PARR.DAL/Services/Implementations/TemplateHistoryService.cs @@ -1,23 +1,13 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.Models; -using PARR.DAL.Services.Abstracts; +using PARR.DAL.Repositories.Base; using PARR.DAL.Services.Interfaces; namespace PARR.DAL.Services.Implementations { - internal class TemplateHistoryService : BaseService, ITemplateHistoryService + internal class TemplateHistoryService : BaseRepository, ITemplateHistoryService { - private readonly DataContext dataContext; - - protected override DbSet EntitySet => dataContext.TemplateHistories; - - protected override DataContext EntitiContext => dataContext; - - public TemplateHistoryService(DataContext dataContext, ILogger logger) : base(logger) - { - this.dataContext = dataContext; - } + public TemplateHistoryService(DataContext dataContext, ILogger logger) : base(logger, dataContext) { } } } diff --git a/PARR.DAL/Services/Implementations/TemplateService.cs b/PARR.DAL/Services/Implementations/TemplateService.cs index ffff3bb9..f7864303 100644 --- a/PARR.DAL/Services/Implementations/TemplateService.cs +++ b/PARR.DAL/Services/Implementations/TemplateService.cs @@ -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