From 2c7ec299f1eee2e303155e3602c2eaf0bd38058d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=BCha=20Kesikba=C5=9F?= Date: Sun, 25 Dec 2022 19:05:16 +0300 Subject: [PATCH] Clean Architecture Updated project folders and files system. --- Core/Hypance.Application/Class1.cs | 6 +++ .../Hypance.Application.csproj | 9 ++++ Core/Hypance.Contracts/Class1.cs | 6 +++ .../Hypance.Contracts.csproj | 9 ++++ Core/Hypance.Domain/Class1.cs | 6 +++ Core/Hypance.Domain/Hypance.Domain.csproj | 9 ++++ .../Hypance.SharedKernel/Domain/BaseEntity.cs | 10 ++++ .../Hypance.SharedKernel.csproj | 15 ++++++ .../Repositories/IRepository.cs | 16 +++++++ .../Results}/DataResult.cs | 2 +- .../Results}/ErrorDataResult.cs | 2 +- .../Results}/ErrorResult.cs | 2 +- .../Results}/IDataResult.cs | 2 +- .../Hypance.SharedKernel/Results}/IResult.cs | 2 +- .../Hypance.SharedKernel/Results}/Result.cs | 2 +- .../Results}/SuccessDataResult.cs | 2 +- .../Results}/SuccessResult.cs | 2 +- Hypance-Backend.sln | 46 +++++++++++++++++++ .../Hypance.Infrastructure/Class1.cs | 6 +++ .../Hypance.Infrastructure.csproj | 9 ++++ Infrastructure/Hypance.Persistence/Class1.cs | 6 +++ .../Hypance.Persistence.csproj | 9 ++++ Libraries/Hypance.Core/Hypance.Core.csproj | 2 + .../Hypance.ScheduledTask.csproj | 4 +- 24 files changed, 174 insertions(+), 10 deletions(-) create mode 100644 Core/Hypance.Application/Class1.cs create mode 100644 Core/Hypance.Application/Hypance.Application.csproj create mode 100644 Core/Hypance.Contracts/Class1.cs create mode 100644 Core/Hypance.Contracts/Hypance.Contracts.csproj create mode 100644 Core/Hypance.Domain/Class1.cs create mode 100644 Core/Hypance.Domain/Hypance.Domain.csproj create mode 100644 Core/Hypance.SharedKernel/Domain/BaseEntity.cs create mode 100644 Core/Hypance.SharedKernel/Hypance.SharedKernel.csproj create mode 100644 Core/Hypance.SharedKernel/Repositories/IRepository.cs rename {Libraries/Hypance.Core/Utilites => Core/Hypance.SharedKernel/Results}/DataResult.cs (91%) rename {Libraries/Hypance.Core/Utilites => Core/Hypance.SharedKernel/Results}/ErrorDataResult.cs (93%) rename {Libraries/Hypance.Core/Utilites => Core/Hypance.SharedKernel/Results}/ErrorResult.cs (88%) rename {Libraries/Hypance.Core/Utilites => Core/Hypance.SharedKernel/Results}/IDataResult.cs (82%) rename {Libraries/Hypance.Core/Utilites => Core/Hypance.SharedKernel/Results}/IResult.cs (83%) rename {Libraries/Hypance.Core/Utilites => Core/Hypance.SharedKernel/Results}/Result.cs (91%) rename {Libraries/Hypance.Core/Utilites => Core/Hypance.SharedKernel/Results}/SuccessDataResult.cs (93%) rename {Libraries/Hypance.Core/Utilites => Core/Hypance.SharedKernel/Results}/SuccessResult.cs (88%) create mode 100644 Infrastructure/Hypance.Infrastructure/Class1.cs create mode 100644 Infrastructure/Hypance.Infrastructure/Hypance.Infrastructure.csproj create mode 100644 Infrastructure/Hypance.Persistence/Class1.cs create mode 100644 Infrastructure/Hypance.Persistence/Hypance.Persistence.csproj diff --git a/Core/Hypance.Application/Class1.cs b/Core/Hypance.Application/Class1.cs new file mode 100644 index 0000000..d21673c --- /dev/null +++ b/Core/Hypance.Application/Class1.cs @@ -0,0 +1,6 @@ +namespace Hypance.Application; +public class Class1 +{ + +} + diff --git a/Core/Hypance.Application/Hypance.Application.csproj b/Core/Hypance.Application/Hypance.Application.csproj new file mode 100644 index 0000000..bafd05b --- /dev/null +++ b/Core/Hypance.Application/Hypance.Application.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/Core/Hypance.Contracts/Class1.cs b/Core/Hypance.Contracts/Class1.cs new file mode 100644 index 0000000..21ffebb --- /dev/null +++ b/Core/Hypance.Contracts/Class1.cs @@ -0,0 +1,6 @@ +namespace Hypance.Contracts; +public class Class1 +{ + +} + diff --git a/Core/Hypance.Contracts/Hypance.Contracts.csproj b/Core/Hypance.Contracts/Hypance.Contracts.csproj new file mode 100644 index 0000000..bafd05b --- /dev/null +++ b/Core/Hypance.Contracts/Hypance.Contracts.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/Core/Hypance.Domain/Class1.cs b/Core/Hypance.Domain/Class1.cs new file mode 100644 index 0000000..3ad4b39 --- /dev/null +++ b/Core/Hypance.Domain/Class1.cs @@ -0,0 +1,6 @@ +namespace Hypance.Domain; +public class Class1 +{ + +} + diff --git a/Core/Hypance.Domain/Hypance.Domain.csproj b/Core/Hypance.Domain/Hypance.Domain.csproj new file mode 100644 index 0000000..bafd05b --- /dev/null +++ b/Core/Hypance.Domain/Hypance.Domain.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/Core/Hypance.SharedKernel/Domain/BaseEntity.cs b/Core/Hypance.SharedKernel/Domain/BaseEntity.cs new file mode 100644 index 0000000..fe5b59b --- /dev/null +++ b/Core/Hypance.SharedKernel/Domain/BaseEntity.cs @@ -0,0 +1,10 @@ +using System.ComponentModel.DataAnnotations; + +namespace Hypance.SharedKernel.Domain +{ + public class BaseEntity + { + [Key] + public int Id { get; set; } + } +} diff --git a/Core/Hypance.SharedKernel/Hypance.SharedKernel.csproj b/Core/Hypance.SharedKernel/Hypance.SharedKernel.csproj new file mode 100644 index 0000000..6fa114f --- /dev/null +++ b/Core/Hypance.SharedKernel/Hypance.SharedKernel.csproj @@ -0,0 +1,15 @@ + + + + net6.0 + enable + enable + + + + + + + + + diff --git a/Core/Hypance.SharedKernel/Repositories/IRepository.cs b/Core/Hypance.SharedKernel/Repositories/IRepository.cs new file mode 100644 index 0000000..66b7229 --- /dev/null +++ b/Core/Hypance.SharedKernel/Repositories/IRepository.cs @@ -0,0 +1,16 @@ +using System.Linq.Expressions; +using Hypance.SharedKernel.Domain; +using Hypance.SharedKernel.Results; + +namespace Hypance.SharedKernel.Repositories +{ + public interface IRepository where T : BaseEntity + { + IDataResult Get(Expression> filter); + IDataResult> GetAll(Expression> filter = null); + IResult Add(T entity); + IResult Update(T entity); + IResult Delete(int entityId); + } +} + diff --git a/Libraries/Hypance.Core/Utilites/DataResult.cs b/Core/Hypance.SharedKernel/Results/DataResult.cs similarity index 91% rename from Libraries/Hypance.Core/Utilites/DataResult.cs rename to Core/Hypance.SharedKernel/Results/DataResult.cs index d248f17..97bf865 100644 --- a/Libraries/Hypance.Core/Utilites/DataResult.cs +++ b/Core/Hypance.SharedKernel/Results/DataResult.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Threading.Tasks; -namespace Hypance.Core.Utilites +namespace Hypance.SharedKernel.Results { public class DataResult : Result, IDataResult { diff --git a/Libraries/Hypance.Core/Utilites/ErrorDataResult.cs b/Core/Hypance.SharedKernel/Results/ErrorDataResult.cs similarity index 93% rename from Libraries/Hypance.Core/Utilites/ErrorDataResult.cs rename to Core/Hypance.SharedKernel/Results/ErrorDataResult.cs index 6cfaa74..b8af72d 100644 --- a/Libraries/Hypance.Core/Utilites/ErrorDataResult.cs +++ b/Core/Hypance.SharedKernel/Results/ErrorDataResult.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Threading.Tasks; -namespace Hypance.Core.Utilites +namespace Hypance.SharedKernel.Results { public class ErrorDataResult : DataResult { diff --git a/Libraries/Hypance.Core/Utilites/ErrorResult.cs b/Core/Hypance.SharedKernel/Results/ErrorResult.cs similarity index 88% rename from Libraries/Hypance.Core/Utilites/ErrorResult.cs rename to Core/Hypance.SharedKernel/Results/ErrorResult.cs index e96551c..ea6890e 100644 --- a/Libraries/Hypance.Core/Utilites/ErrorResult.cs +++ b/Core/Hypance.SharedKernel/Results/ErrorResult.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Threading.Tasks; -namespace Hypance.Core.Utilites +namespace Hypance.SharedKernel.Results { public class ErrorResult : Result { diff --git a/Libraries/Hypance.Core/Utilites/IDataResult.cs b/Core/Hypance.SharedKernel/Results/IDataResult.cs similarity index 82% rename from Libraries/Hypance.Core/Utilites/IDataResult.cs rename to Core/Hypance.SharedKernel/Results/IDataResult.cs index 8075079..74942fd 100644 --- a/Libraries/Hypance.Core/Utilites/IDataResult.cs +++ b/Core/Hypance.SharedKernel/Results/IDataResult.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Threading.Tasks; -namespace Hypance.Core.Utilites +namespace Hypance.SharedKernel.Results { public interface IDataResult : IResult { diff --git a/Libraries/Hypance.Core/Utilites/IResult.cs b/Core/Hypance.SharedKernel/Results/IResult.cs similarity index 83% rename from Libraries/Hypance.Core/Utilites/IResult.cs rename to Core/Hypance.SharedKernel/Results/IResult.cs index 0493459..45f8ae8 100644 --- a/Libraries/Hypance.Core/Utilites/IResult.cs +++ b/Core/Hypance.SharedKernel/Results/IResult.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Threading.Tasks; -namespace Hypance.Core.Utilites +namespace Hypance.SharedKernel.Results { public interface IResult { diff --git a/Libraries/Hypance.Core/Utilites/Result.cs b/Core/Hypance.SharedKernel/Results/Result.cs similarity index 91% rename from Libraries/Hypance.Core/Utilites/Result.cs rename to Core/Hypance.SharedKernel/Results/Result.cs index 61a8adf..73e9ca9 100644 --- a/Libraries/Hypance.Core/Utilites/Result.cs +++ b/Core/Hypance.SharedKernel/Results/Result.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Threading.Tasks; -namespace Hypance.Core.Utilites +namespace Hypance.SharedKernel.Results { public class Result : IResult { diff --git a/Libraries/Hypance.Core/Utilites/SuccessDataResult.cs b/Core/Hypance.SharedKernel/Results/SuccessDataResult.cs similarity index 93% rename from Libraries/Hypance.Core/Utilites/SuccessDataResult.cs rename to Core/Hypance.SharedKernel/Results/SuccessDataResult.cs index 860e5b7..a13c0ea 100644 --- a/Libraries/Hypance.Core/Utilites/SuccessDataResult.cs +++ b/Core/Hypance.SharedKernel/Results/SuccessDataResult.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Threading.Tasks; -namespace Hypance.Core.Utilites +namespace Hypance.SharedKernel.Results { public class SuccessDataResult : DataResult { diff --git a/Libraries/Hypance.Core/Utilites/SuccessResult.cs b/Core/Hypance.SharedKernel/Results/SuccessResult.cs similarity index 88% rename from Libraries/Hypance.Core/Utilites/SuccessResult.cs rename to Core/Hypance.SharedKernel/Results/SuccessResult.cs index 659cbf6..0722117 100644 --- a/Libraries/Hypance.Core/Utilites/SuccessResult.cs +++ b/Core/Hypance.SharedKernel/Results/SuccessResult.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Threading.Tasks; -namespace Hypance.Core.Utilites +namespace Hypance.SharedKernel.Results { public class SuccessResult : Result { diff --git a/Hypance-Backend.sln b/Hypance-Backend.sln index 587077e..d244123 100644 --- a/Hypance-Backend.sln +++ b/Hypance-Backend.sln @@ -19,6 +19,22 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ScheduledTask", "ScheduledT EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hypance.ScheduledTask", "ScheduledTask\Hypance.ScheduledTask\Hypance.ScheduledTask.csproj", "{529E57BB-137F-45ED-8D68-0E1643334C1C}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{D0FD4D26-1367-49EE-8A5F-EBF7791980B4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hypance.Domain", "Core\Hypance.Domain\Hypance.Domain.csproj", "{9862D51C-1FA4-4187-9E58-A6C734C040AD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hypance.Application", "Core\Hypance.Application\Hypance.Application.csproj", "{7C00FED1-91BA-4BD9-ACC9-E5F1CB4A4B38}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hypance.SharedKernel", "Core\Hypance.SharedKernel\Hypance.SharedKernel.csproj", "{5448C411-703B-4EBB-B8F2-F664DF253282}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hypance.Contracts", "Core\Hypance.Contracts\Hypance.Contracts.csproj", "{30D57BD9-4E74-48E2-A4AF-4F33AED77E48}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{03A8470D-E194-4853-84BF-062E962B4A01}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hypance.Persistence", "Infrastructure\Hypance.Persistence\Hypance.Persistence.csproj", "{8654FCE3-6100-4725-BAD5-504DE88480AB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hypance.Infrastructure", "Infrastructure\Hypance.Infrastructure\Hypance.Infrastructure.csproj", "{80BE653A-419B-4E1E-8EE3-5C301AB8A85E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -45,6 +61,30 @@ Global {529E57BB-137F-45ED-8D68-0E1643334C1C}.Debug|Any CPU.Build.0 = Debug|Any CPU {529E57BB-137F-45ED-8D68-0E1643334C1C}.Release|Any CPU.ActiveCfg = Release|Any CPU {529E57BB-137F-45ED-8D68-0E1643334C1C}.Release|Any CPU.Build.0 = Release|Any CPU + {9862D51C-1FA4-4187-9E58-A6C734C040AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9862D51C-1FA4-4187-9E58-A6C734C040AD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9862D51C-1FA4-4187-9E58-A6C734C040AD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9862D51C-1FA4-4187-9E58-A6C734C040AD}.Release|Any CPU.Build.0 = Release|Any CPU + {7C00FED1-91BA-4BD9-ACC9-E5F1CB4A4B38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7C00FED1-91BA-4BD9-ACC9-E5F1CB4A4B38}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7C00FED1-91BA-4BD9-ACC9-E5F1CB4A4B38}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7C00FED1-91BA-4BD9-ACC9-E5F1CB4A4B38}.Release|Any CPU.Build.0 = Release|Any CPU + {5448C411-703B-4EBB-B8F2-F664DF253282}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5448C411-703B-4EBB-B8F2-F664DF253282}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5448C411-703B-4EBB-B8F2-F664DF253282}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5448C411-703B-4EBB-B8F2-F664DF253282}.Release|Any CPU.Build.0 = Release|Any CPU + {30D57BD9-4E74-48E2-A4AF-4F33AED77E48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {30D57BD9-4E74-48E2-A4AF-4F33AED77E48}.Debug|Any CPU.Build.0 = Debug|Any CPU + {30D57BD9-4E74-48E2-A4AF-4F33AED77E48}.Release|Any CPU.ActiveCfg = Release|Any CPU + {30D57BD9-4E74-48E2-A4AF-4F33AED77E48}.Release|Any CPU.Build.0 = Release|Any CPU + {8654FCE3-6100-4725-BAD5-504DE88480AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8654FCE3-6100-4725-BAD5-504DE88480AB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8654FCE3-6100-4725-BAD5-504DE88480AB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8654FCE3-6100-4725-BAD5-504DE88480AB}.Release|Any CPU.Build.0 = Release|Any CPU + {80BE653A-419B-4E1E-8EE3-5C301AB8A85E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {80BE653A-419B-4E1E-8EE3-5C301AB8A85E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {80BE653A-419B-4E1E-8EE3-5C301AB8A85E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {80BE653A-419B-4E1E-8EE3-5C301AB8A85E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -58,5 +98,11 @@ Global {25F0F8C2-CF61-4B50-AB62-9D62FD5308E8} = {8F83706A-B74D-49BF-BD78-4001EC8EF7DF} {D2EB1F1F-DC79-4229-AC70-2B0C3F0C88B4} = {FF2C3635-23E1-46FE-B091-7FF905785C8B} {529E57BB-137F-45ED-8D68-0E1643334C1C} = {2717AC29-9F24-4C1F-A7CC-6B98DC73A679} + {9862D51C-1FA4-4187-9E58-A6C734C040AD} = {D0FD4D26-1367-49EE-8A5F-EBF7791980B4} + {7C00FED1-91BA-4BD9-ACC9-E5F1CB4A4B38} = {D0FD4D26-1367-49EE-8A5F-EBF7791980B4} + {5448C411-703B-4EBB-B8F2-F664DF253282} = {D0FD4D26-1367-49EE-8A5F-EBF7791980B4} + {30D57BD9-4E74-48E2-A4AF-4F33AED77E48} = {D0FD4D26-1367-49EE-8A5F-EBF7791980B4} + {8654FCE3-6100-4725-BAD5-504DE88480AB} = {03A8470D-E194-4853-84BF-062E962B4A01} + {80BE653A-419B-4E1E-8EE3-5C301AB8A85E} = {03A8470D-E194-4853-84BF-062E962B4A01} EndGlobalSection EndGlobal diff --git a/Infrastructure/Hypance.Infrastructure/Class1.cs b/Infrastructure/Hypance.Infrastructure/Class1.cs new file mode 100644 index 0000000..8b64ba3 --- /dev/null +++ b/Infrastructure/Hypance.Infrastructure/Class1.cs @@ -0,0 +1,6 @@ +namespace Hypance.Infrastructure; +public class Class1 +{ + +} + diff --git a/Infrastructure/Hypance.Infrastructure/Hypance.Infrastructure.csproj b/Infrastructure/Hypance.Infrastructure/Hypance.Infrastructure.csproj new file mode 100644 index 0000000..bafd05b --- /dev/null +++ b/Infrastructure/Hypance.Infrastructure/Hypance.Infrastructure.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/Infrastructure/Hypance.Persistence/Class1.cs b/Infrastructure/Hypance.Persistence/Class1.cs new file mode 100644 index 0000000..2241dbe --- /dev/null +++ b/Infrastructure/Hypance.Persistence/Class1.cs @@ -0,0 +1,6 @@ +namespace Hypance.Persistence; +public class Class1 +{ + +} + diff --git a/Infrastructure/Hypance.Persistence/Hypance.Persistence.csproj b/Infrastructure/Hypance.Persistence/Hypance.Persistence.csproj new file mode 100644 index 0000000..bafd05b --- /dev/null +++ b/Infrastructure/Hypance.Persistence/Hypance.Persistence.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/Libraries/Hypance.Core/Hypance.Core.csproj b/Libraries/Hypance.Core/Hypance.Core.csproj index 5e56a74..1563863 100644 --- a/Libraries/Hypance.Core/Hypance.Core.csproj +++ b/Libraries/Hypance.Core/Hypance.Core.csproj @@ -17,8 +17,10 @@ + + diff --git a/ScheduledTask/Hypance.ScheduledTask/Hypance.ScheduledTask.csproj b/ScheduledTask/Hypance.ScheduledTask/Hypance.ScheduledTask.csproj index a0d224d..29c77ea 100644 --- a/ScheduledTask/Hypance.ScheduledTask/Hypance.ScheduledTask.csproj +++ b/ScheduledTask/Hypance.ScheduledTask/Hypance.ScheduledTask.csproj @@ -12,7 +12,7 @@ - - + +