Skip to content

Commit dc87942

Browse files
committed
UPDATE: add scrutor lib - Ws.Desktop.Api
1 parent 0f4bb37 commit dc87942

File tree

6 files changed

+11
-18
lines changed

6 files changed

+11
-18
lines changed

Src/Apps/Desktop/Ws.Desktop.Api/App/Features/Arms/Impl/ArmService.cs Src/Apps/Desktop/Ws.Desktop.Api/App/Features/Arms/Impl/ArmApiService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Ws.Desktop.Api.App.Features.Arms.Impl;
1010

11-
public class ArmService(WsDbContext dbContext) : IArmService
11+
public class ArmApiService(WsDbContext dbContext) : IArmService
1212
{
1313
#region Queries
1414

Src/Apps/Desktop/Ws.Desktop.Api/App/Features/PalletMen/Impl/PalletManService.cs Src/Apps/Desktop/Ws.Desktop.Api/App/Features/PalletMen/Impl/PalletManApiService.cs

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

66
namespace Ws.Desktop.Api.App.Features.PalletMen.Impl;
77

8-
public class PalletManService(WsDbContext dbContext) : IPalletManService
8+
public class PalletManApiService(WsDbContext dbContext) : IPalletManService
99
{
1010
#region Queries
1111

Src/Apps/Desktop/Ws.Desktop.Api/App/Features/Plu/Impl/Piece/PluPieceService.cs Src/Apps/Desktop/Ws.Desktop.Api/App/Features/Plu/Impl/Piece/PluPieceApiService.cs

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

66
namespace Ws.Desktop.Api.App.Features.Plu.Impl.Piece;
77

8-
public class PluPieceService(IArmService armService, WsDbContext dbContext) : IPluPieceService
8+
public class PluPieceApiService(IArmService armService, WsDbContext dbContext) : IPluPieceService
99
{
1010
#region Queries
1111

Src/Apps/Desktop/Ws.Desktop.Api/App/Features/Plu/Impl/Weight/PluWeightService.cs Src/Apps/Desktop/Ws.Desktop.Api/App/Features/Plu/Impl/Weight/PluWeightApiService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace Ws.Desktop.Api.App.Features.Plu.Impl.Weight;
1414

15-
public class PluWeightService(
15+
public class PluWeightApiService(
1616
IPrintLabelService printLabelService,
1717
IPluService pluService,
1818
IArmService armService,

Src/Apps/Desktop/Ws.Desktop.Api/Program.cs

+6-13
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,7 @@
33
using Microsoft.AspNetCore.Mvc;
44
using Microsoft.AspNetCore.Mvc.Authorization;
55
using Ws.Database.EntityFramework;
6-
using Ws.Desktop.Api.App.Features.Arms.Common;
76
using Ws.Desktop.Api.App.Features.Arms.Impl;
8-
using Ws.Desktop.Api.App.Features.PalletMen.Common;
9-
using Ws.Desktop.Api.App.Features.PalletMen.Impl;
10-
using Ws.Desktop.Api.App.Features.Pallets.Common;
11-
using Ws.Desktop.Api.App.Features.Pallets.Impl;
12-
using Ws.Desktop.Api.App.Features.Plu.Common;
13-
using Ws.Desktop.Api.App.Features.Plu.Impl.Piece;
14-
using Ws.Desktop.Api.App.Features.Plu.Impl.Weight;
157
using Ws.Desktop.Api.App.Middlewares;
168
using Ws.Domain.Services;
179
using Ws.Labels.Service;
@@ -22,11 +14,12 @@
2214

2315
#region Internal services
2416

25-
builder.Services.AddScoped<IArmService, ArmService>();
26-
builder.Services.AddScoped<IPluPieceService, PluPieceService>();
27-
builder.Services.AddScoped<IPluWeightService, PluWeightService>();
28-
builder.Services.AddScoped<IPalletManService, PalletManService>();
29-
builder.Services.AddScoped<IPalletApiService, PalletApiService>();
17+
builder.Services.Scan(scan => scan
18+
.FromAssembliesOf(typeof(ArmApiService))
19+
.AddClasses(classes => classes.Where(type => type.Name.EndsWith("ApiService")))
20+
.AsImplementedInterfaces()
21+
.WithScopedLifetime()
22+
);
3023

3124
#endregion
3225

Src/Apps/Desktop/Ws.Desktop.Api/Ws.Desktop.Api.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
<ProjectReference Include="..\Ws.Desktop.Models\Ws.Desktop.Models.csproj"/>
88
</ItemGroup>
99
<ItemGroup>
10-
<Folder Include="App\Features\Plu\Impl\Weight\Extensions\" />
10+
<PackageReference Include="Scrutor" Version="4.2.2" />
1111
</ItemGroup>
1212
</Project>

0 commit comments

Comments
 (0)