Skip to content

Commit ce62de9

Browse files
committed
Updated WebApiToolkit from 5.1.0 to 5.2.0
1 parent 5ea664a commit ce62de9

File tree

16 files changed

+62
-44
lines changed

16 files changed

+62
-44
lines changed

WeatherControl/Wissance.WeatherControl.Common/Wissance.WeatherControl.Common.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Wissance.WebApiToolkit.Core" Version="5.1.0" />
10+
<PackageReference Include="Wissance.WebApiToolkit.Core" Version="5.2.0" />
1111
</ItemGroup>
1212

1313
</Project>

WeatherControl/Wissance.WeatherControl.Data/Wissance.WeatherControl.Data.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</PropertyGroup>
77

88
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
9-
<PackageReference Include="Wissance.WebApiToolkit.Core" Version="5.1.0" />
9+
<PackageReference Include="Wissance.WebApiToolkit.Core" Version="5.2.0" />
1010
</ItemGroup>
1111

1212
</Project>

WeatherControl/Wissance.WeatherControl.Ef.Data/Wissance.WeatherControl.Ef.Data.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<PrivateAssets>all</PrivateAssets>
1818
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1919
</PackageReference>
20-
<PackageReference Include="Wissance.WebApiToolkit.Data.Ef" Version="5.1.0" />
20+
<PackageReference Include="Wissance.WebApiToolkit.Data.Ef" Version="5.2.0" />
2121
</ItemGroup>
2222

2323
<ItemGroup>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
3+
namespace Wissance.WeatherControl.SemiAuto.WebApi.Controllers
4+
{
5+
[ApiController]
6+
public class EmptyController : ControllerBase
7+
{
8+
}
9+
}

WeatherControl/Wissance.WeatherControl.SemiAuto.WebApi/Startup.cs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,28 @@ private void ConfigureWebApi(IServiceCollection services)
9393
{
9494
services.AddSwaggerGen();
9595
ServiceProvider provider = services.BuildServiceProvider();
96-
Assembly stationControllerAssembly = services.AddSimplifiedAutoController<StationEntity, Guid, EmptyAdditionalFilters>(
97-
provider.GetRequiredService<ModelContext>(), "Station",
98-
ControllerType.FullCrud, null, provider.GetRequiredService<ILoggerFactory>());
99-
Assembly measureUnitControllerAssembly = services.AddSimplifiedAutoController<MeasureUnitEntity, Guid, EmptyAdditionalFilters>(
100-
provider.GetRequiredService<ModelContext>(), "MeasureUnit",
101-
ControllerType.ReadOnly, null, provider.GetRequiredService<ILoggerFactory>());
102-
Assembly sensorControllerAssembly = services.AddSimplifiedAutoController<SensorEntity, Guid, EmptyAdditionalFilters>(
103-
provider.GetRequiredService<ModelContext>(), "Sensor",
104-
ControllerType.FullCrud, null, provider.GetRequiredService<ILoggerFactory>());
105-
Assembly measurementControllerAssembly = services.AddSimplifiedAutoController<MeasurementEntity, Guid, EmptyAdditionalFilters>(
106-
provider.GetRequiredService<ModelContext>(), "Measurement",
107-
ControllerType.Bulk, null, provider.GetRequiredService<ILoggerFactory>());
108-
109-
services.AddControllers().AddApplicationPart(sensorControllerAssembly).AddControllersAsServices();
110-
services.AddControllers().AddApplicationPart(stationControllerAssembly).AddControllersAsServices();
96+
ModelContext dbContext = provider.GetRequiredService<ModelContext>();
97+
ILoggerFactory loggerFactory = provider.GetRequiredService<ILoggerFactory>();
98+
99+
Assembly measureUnitControllerAssembly =
100+
services.AddSimplifiedAutoController<ModelContext, MeasureUnitEntity, Guid, EmptyAdditionalFilters>(dbContext,
101+
"MeasureUnit", ControllerType.ReadOnly, null, loggerFactory);
102+
Assembly stationControllerAssembly =
103+
services.AddSimplifiedAutoController<ModelContext, StationEntity, Guid, EmptyAdditionalFilters>(dbContext,
104+
"Station", ControllerType.FullCrud, null, loggerFactory);
105+
Assembly sensorControllerAssembly =
106+
services.AddSimplifiedAutoController<ModelContext, SensorEntity, Guid, EmptyAdditionalFilters>(dbContext,
107+
"Sensor", ControllerType.FullCrud, null, loggerFactory);
108+
Assembly measurementControllerAssembly =
109+
services.AddSimplifiedAutoController<ModelContext, MeasurementEntity, Guid, EmptyAdditionalFilters>(dbContext,
110+
"Measurement", ControllerType.Bulk, null, loggerFactory);
111+
111112
services.AddControllers().AddApplicationPart(measureUnitControllerAssembly).AddControllersAsServices();
113+
services.AddControllers().AddApplicationPart(stationControllerAssembly).AddControllersAsServices();
114+
services.AddControllers().AddApplicationPart(sensorControllerAssembly).AddControllersAsServices();
112115
services.AddControllers().AddApplicationPart(measurementControllerAssembly).AddControllersAsServices();
116+
117+
services.AddControllers();
113118
}
114119

115120
public ApplicationSettings Settings { get; set; }

WeatherControl/Wissance.WeatherControl.SemiAuto.WebApi/Wissance.WeatherControl.SemiAuto.WebApi.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
1818
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.5.0" />
1919
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.5.0" />
20-
<PackageReference Include="Wissance.WebApiToolkit.Ef" Version="5.1.0" />
20+
<PackageReference Include="Wissance.WebApiToolkit.Ef" Version="5.2.0" />
2121
<!--<PackageReference Include="Wissance.WebApiToolkit.Ef" Version="5.0.0" />-->
2222
</ItemGroup>
2323

WeatherControl/Wissance.WeatherControl.WebApi.V2/Wissance.WeatherControl.WebApi.V2.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.5.0" />
1616
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.5.0" />
1717
<PackageReference Include="Wissance.EdgeDb.Configurator" Version="1.2.0" />
18-
<PackageReference Include="Wissance.WebApiToolkit.Core" Version="5.1.0" />
18+
<PackageReference Include="Wissance.WebApiToolkit.Core" Version="5.2.0" />
1919
</ItemGroup>
2020

2121
<ItemGroup>

WeatherControl/Wissance.WeatherControl/Factory/MeasureUnitFactory.cs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
using System;
2+
using Wissance.WeatherControl.Data;
23
using Wissance.WeatherControl.Data.Entity;
34
using Wissance.WeatherControl.Dto;
45

56
namespace Wissance.WeatherControl.WebApi.Factory
67
{
78
internal static class MeasureUnitFactory
89
{
9-
public static MeasureUnitEntity Create(MeasureUnitDto dto)
10-
{
11-
MeasureUnitEntity entity = new MeasureUnitEntity()
12-
{
13-
Name = dto.Name,
14-
Description = dto.Description,
15-
Abbreviation = dto.Abbreviation
16-
};
17-
return entity;
18-
}
19-
2010
public static MeasureUnitDto Create(MeasureUnitEntity entity)
2111
{
2212
return new MeasureUnitDto()
@@ -27,8 +17,19 @@ public static MeasureUnitDto Create(MeasureUnitEntity entity)
2717
Abbreviation = entity.Abbreviation
2818
};
2919
}
20+
21+
public static MeasureUnitEntity Create(MeasureUnitDto dto, ModelContext context)
22+
{
23+
MeasureUnitEntity entity = new MeasureUnitEntity()
24+
{
25+
Name = dto.Name,
26+
Description = dto.Description,
27+
Abbreviation = dto.Abbreviation
28+
};
29+
return entity;
30+
}
3031

31-
public static void Update(MeasureUnitDto data, Guid id, MeasureUnitEntity entity)
32+
public static void Update(MeasureUnitDto data, Guid id, ModelContext context, MeasureUnitEntity entity)
3233
{
3334
entity.Name = data.Name;
3435
entity.Description = data.Description;

WeatherControl/Wissance.WeatherControl/Factory/MeasurementFactory.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Threading.Tasks;
5+
using Wissance.WeatherControl.Data;
56
using Wissance.WeatherControl.Data.Entity;
67
using Wissance.WeatherControl.Dto;
78

@@ -14,7 +15,7 @@ public static MeasurementDto Create(MeasurementEntity entity)
1415
return new MeasurementDto(entity.Id, entity.SampleDate, entity.Value, entity.SensorId);
1516
}
1617

17-
public static MeasurementEntity Create(MeasurementDto dto)
18+
public static MeasurementEntity Create(MeasurementDto dto, ModelContext context)
1819
{
1920
return new MeasurementEntity()
2021
{
@@ -25,7 +26,7 @@ public static MeasurementEntity Create(MeasurementDto dto)
2526
};
2627
}
2728

28-
public static void Update(MeasurementDto data, Guid id, MeasurementEntity entity)
29+
public static void Update(MeasurementDto data, Guid id, ModelContext context, MeasurementEntity entity)
2930
{
3031
entity.Value = data.Value;
3132
entity.SampleDate = data.SampleDate;

WeatherControl/Wissance.WeatherControl/Factory/SensorFactory.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using Wissance.WeatherControl.Data;
23
using Wissance.WeatherControl.Data.Entity;
34
using Wissance.WeatherControl.Dto;
45

@@ -20,7 +21,7 @@ public static SensorEntity Create(SensorDto dto)
2021
return entity;
2122
}
2223

23-
public static SensorEntity Create(SensorMinDataDto dto)
24+
public static SensorEntity Create(SensorMinDataDto dto, ModelContext context)
2425
{
2526
SensorEntity entity = new SensorEntity()
2627
{
@@ -63,7 +64,7 @@ public static SensorMinDataDto CreateMin(SensorEntity entity)
6364
};
6465
}
6566

66-
public static void Update(SensorDto data, Guid id, SensorEntity entity)
67+
public static void Update(SensorDto data, Guid id, ModelContext context, SensorEntity entity)
6768
{
6869
entity.Name = data.Name;
6970
entity.Description = data.Description;

0 commit comments

Comments
 (0)