Skip to content

Commit 0f4bb37

Browse files
committed
UPDATE: add scrutor lib for Ws.Palych.Exchange
1 parent 3f1d19a commit 0f4bb37

15 files changed

+22
-33
lines changed

Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Boxes/Services/BoxService.cs Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Boxes/Services/BoxApiService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Ws.PalychExchangeApi.Features.Boxes.Services;
77

8-
internal partial class BoxService(BoxDtoValidator validator) : BaseService<BoxDto>(validator), IBoxService
8+
internal partial class BoxApiService(BoxDtoValidator validator) : BaseService<BoxDto>(validator), IBoxService
99
{
1010
public ResponseDto Load(BoxesWrapper dtoWrapper)
1111
{

Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Boxes/Services/BoxService.private.cs Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Boxes/Services/BoxApiService.private.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Ws.PalychExchangeApi.Features.Boxes.Services;
66

7-
internal partial class BoxService
7+
internal partial class BoxApiService
88
{
99
private void SaveBoxes(IEnumerable<BoxDto> validDtos)
1010
{

Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Brands/Services/BrandService.cs Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Brands/Services/BrandApiService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Ws.PalychExchangeApi.Features.Brands.Services;
77

8-
internal partial class BrandService(BrandDtoValidator validator) : BaseService<BrandDto>(validator), IBrandService
8+
internal partial class BrandApiService(BrandDtoValidator validator) : BaseService<BrandDto>(validator), IBrandService
99
{
1010
public ResponseDto Load(BrandsWrapper dtoWrapper)
1111
{

Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Brands/Services/BrandService.private.cs Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Brands/Services/BrandApiService.private.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Ws.PalychExchangeApi.Features.Brands.Services;
66

7-
internal partial class BrandService
7+
internal partial class BrandApiService
88
{
99
#region Resolve uniques db
1010

Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Bundles/Services/BundleService.cs Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Bundles/Services/BundleApiService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Ws.PalychExchangeApi.Features.Bundles.Services;
77

8-
internal partial class BundleService(BundleDtoValidator validator) : BaseService<BundleDto>(validator), IBundleService
8+
internal partial class BundleApiService(BundleDtoValidator validator) : BaseService<BundleDto>(validator), IBundleService
99
{
1010
public ResponseDto Load(BundlesWrapper dtoWrapper)
1111
{

Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Bundles/Services/BundleService.private.cs Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Bundles/Services/BundleApiService.private.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Ws.PalychExchangeApi.Features.Bundles.Services;
66

7-
internal partial class BundleService
7+
internal partial class BundleApiService
88
{
99
private void SaveBundles(IEnumerable<BundleDto> validDtos)
1010
{

Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Characteristics/Services/CharacteristicService.cs Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Characteristics/Services/CharacteristicApiService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Ws.PalychExchangeApi.Features.Characteristics.Services;
88

9-
internal sealed partial class CharacteristicService(GroupedCharacteristicValidator validator) :
9+
internal sealed partial class CharacteristicApiService(GroupedCharacteristicValidator validator) :
1010
BaseService<GroupedCharacteristic>(validator), ICharacteristicService
1111
{
1212
public ResponseDto Load(PluCharacteristicsWrapper dtoWrapper)

Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Characteristics/Services/CharacteristicService.private.cs Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Characteristics/Services/CharacteristicApiService.private.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Ws.PalychExchangeApi.Features.Characteristics.Services;
66

7-
internal sealed partial class CharacteristicService
7+
internal sealed partial class CharacteristicApiService
88
{
99
#region Resolve uniques Db
1010

Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Clips/Services/ClipService.cs Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Clips/Services/ClipApiService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Ws.PalychExchangeApi.Features.Clips.Services;
77

8-
internal partial class ClipService(ClipDtoValidator validator) : BaseService<ClipDto>(validator), IClipService
8+
internal partial class ClipApiService(ClipDtoValidator validator) : BaseService<ClipDto>(validator), IClipService
99
{
1010
public ResponseDto Load(ClipsWrapper dtoWrapper)
1111
{

Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Clips/Services/ClipService.private.cs Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Clips/Services/ClipApiService.private.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Ws.PalychExchangeApi.Features.Clips.Services;
66

7-
internal partial class ClipService
7+
internal partial class ClipApiService
88
{
99
private void SaveClips(IEnumerable<ClipDto> validDtos)
1010
{

Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Pallets/Services/PalletService.cs Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Pallets/Services/PalletApiService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Ws.PalychExchangeApi.Features.Pallets.Services;
77

8-
internal class PalletService(WsDbContext context) : IPalletService
8+
internal class PalletApiService(WsDbContext context) : IPalletService
99
{
1010
public PalletUpdateStatus Update(PalletUpdateDto dto)
1111
{

Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Plus/Services/PluService.cs Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Plus/Services/PluApiService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Ws.PalychExchangeApi.Features.Plus.Services;
77

8-
internal sealed partial class PluService(PluDtoValidator validator) : BaseService<PluDto>(validator), IPluService
8+
internal sealed partial class PluApiService(PluDtoValidator validator) : BaseService<PluDto>(validator), IPluService
99
{
1010
public ResponseDto Load(PlusWrapper dtoWrapper)
1111
{

Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Plus/Services/PluService.private.cs Src/Apps/Exchange/Ws.PalychExchangeApi/Features/Plus/Services/PluApiService.private.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace Ws.PalychExchangeApi.Features.Plus.Services;
1010

1111

12-
internal sealed partial class PluService
12+
internal sealed partial class PluApiService
1313
{
1414
#region Resolve uniques db
1515

Src/Apps/Exchange/Ws.PalychExchangeApi/Program.cs

+8-20
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
using Ws.Database.EntityFramework;
22
using Ws.PalychExchangeApi.Extensions;
3-
using Ws.PalychExchangeApi.Features.Boxes.Common;
4-
using Ws.PalychExchangeApi.Features.Boxes.Services;
5-
using Ws.PalychExchangeApi.Features.Brands.Common;
6-
using Ws.PalychExchangeApi.Features.Brands.Services;
7-
using Ws.PalychExchangeApi.Features.Bundles.Common;
8-
using Ws.PalychExchangeApi.Features.Bundles.Services;
9-
using Ws.PalychExchangeApi.Features.Characteristics.Common;
10-
using Ws.PalychExchangeApi.Features.Characteristics.Services;
11-
using Ws.PalychExchangeApi.Features.Clips.Common;
12-
using Ws.PalychExchangeApi.Features.Clips.Services;
13-
using Ws.PalychExchangeApi.Features.Pallets.Common;
14-
using Ws.PalychExchangeApi.Features.Plus.Common;
153
using Ws.PalychExchangeApi.Features.Plus.Services;
16-
174
using Ws.PalychExchangeApi.Middlewares;
185

196
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
@@ -24,14 +11,15 @@
2411

2512
builder.Services.AddEfCore();
2613

14+
15+
builder.Services.Scan(scan => scan
16+
.FromAssembliesOf(typeof(PluApiService))
17+
.AddClasses(classes => classes.Where(type => type.Name.EndsWith("ApiService")))
18+
.AsImplementedInterfaces()
19+
.WithScopedLifetime()
20+
);
21+
2722
builder.Services.AddValidators();
28-
builder.Services.AddScoped<IBoxService, BoxService>();
29-
builder.Services.AddScoped<IClipService, ClipService>();
30-
builder.Services.AddScoped<IBundleService, BundleService>();
31-
builder.Services.AddScoped<IBrandService, BrandService>();
32-
builder.Services.AddScoped<IPluService, PluService>();
33-
builder.Services.AddScoped<ICharacteristicService, CharacteristicService>();
34-
builder.Services.AddScoped<IPalletService, Ws.PalychExchangeApi.Features.Pallets.Services.PalletService>();
3523

3624
#pragma warning disable CA1416
3725

Src/Apps/Exchange/Ws.PalychExchangeApi/Ws.PalychExchangeApi.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<ItemGroup>
33
<PackageReference Include="FluentValidation" Version="11.9.2" />
44
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="8.0.0" />
5+
<PackageReference Include="Scrutor" Version="4.2.2" />
56
<PackageReference Include="Z.EntityFramework.Extensions.EFCore" Version="8.103.0" />
67
</ItemGroup>
78
<ItemGroup>

0 commit comments

Comments
 (0)