|
|
|
@ -1,4 +1,3 @@ |
|
|
|
|
|
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
using Microsoft.OpenApi.Models; |
|
|
|
using Microsoft.OpenApi.Models; |
|
|
|
using ParkingLotEntity.DB; |
|
|
|
using ParkingLotEntity.DB; |
|
|
|
@ -6,6 +5,7 @@ using ParkingLotEntity.ParkingLotModels; |
|
|
|
using ParkingLotService.API.HostService; |
|
|
|
using ParkingLotService.API.HostService; |
|
|
|
using ParkLotInfoService; |
|
|
|
using ParkLotInfoService; |
|
|
|
using Serilog; |
|
|
|
using Serilog; |
|
|
|
|
|
|
|
|
|
|
|
namespace ParkingLotService.API |
|
|
|
namespace ParkingLotService.API |
|
|
|
{ |
|
|
|
{ |
|
|
|
public class Program |
|
|
|
public class Program |
|
|
|
@ -44,9 +44,11 @@ namespace ParkingLotService.API |
|
|
|
builder.Services.AddScoped<WeiCloud.Utils.IRedisHelper, WeiCloud.Utils.RedisHelper>(); |
|
|
|
builder.Services.AddScoped<WeiCloud.Utils.IRedisHelper, WeiCloud.Utils.RedisHelper>(); |
|
|
|
builder.Services.AddScoped<WeiCloud.Utils.IDictionaryService, WeiCloud.Utils.DictionaryService>(); |
|
|
|
builder.Services.AddScoped<WeiCloud.Utils.IDictionaryService, WeiCloud.Utils.DictionaryService>(); |
|
|
|
builder.Services.AddScoped<IParkingLotDataService, ParkingLotDataService>(); |
|
|
|
builder.Services.AddScoped<IParkingLotDataService, ParkingLotDataService>(); |
|
|
|
|
|
|
|
|
|
|
|
//--- |
|
|
|
//--- |
|
|
|
|
|
|
|
|
|
|
|
#region 日志 |
|
|
|
#region 日志 |
|
|
|
|
|
|
|
|
|
|
|
Log.Logger = new LoggerConfiguration() |
|
|
|
Log.Logger = new LoggerConfiguration() |
|
|
|
.MinimumLevel.Information() // 最低日志级别 |
|
|
|
.MinimumLevel.Information() // 最低日志级别 |
|
|
|
.WriteTo.File( |
|
|
|
.WriteTo.File( |
|
|
|
@ -60,7 +62,8 @@ namespace ParkingLotService.API |
|
|
|
builder.Services.AddHttpClient(); |
|
|
|
builder.Services.AddHttpClient(); |
|
|
|
//使用 Serilog 替换默认日志 |
|
|
|
//使用 Serilog 替换默认日志 |
|
|
|
builder.Host.UseSerilog(); |
|
|
|
builder.Host.UseSerilog(); |
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
#endregion 日志 |
|
|
|
|
|
|
|
|
|
|
|
// 注册PingService |
|
|
|
// 注册PingService |
|
|
|
builder.Services.AddHostedService<PingService>(); |
|
|
|
builder.Services.AddHostedService<PingService>(); |
|
|
|
@ -75,8 +78,6 @@ namespace ParkingLotService.API |
|
|
|
c.SwaggerEndpoint("/swagger/v1/swagger.json", "ParkingLotAPI V1"); |
|
|
|
c.SwaggerEndpoint("/swagger/v1/swagger.json", "ParkingLotAPI V1"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var app = builder.Build(); |
|
|
|
//var app = builder.Build(); |
|
|
|
|
|
|
|
|
|
|
|
@ -91,10 +92,9 @@ namespace ParkingLotService.API |
|
|
|
|
|
|
|
|
|
|
|
app.UseAuthorization(); |
|
|
|
app.UseAuthorization(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.MapControllers(); |
|
|
|
app.MapControllers(); |
|
|
|
|
|
|
|
|
|
|
|
app.Run(); |
|
|
|
app.Run(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |