yanjinhui
2025-02-28 880766ff5ccc98f1def11cd3c6e15e860f143ada
项目代码/WIDESEAWCS_Server 正式/WIDESEAWCS_Server/Program.cs
@@ -23,7 +23,6 @@
using Microsoft.AspNetCore.Builder;
using WIDESEA_SerialPortService;
using WIDESEA_ISerialPortService;
using WIDESEA_SerialPortTestService;
var builder = WebApplication.CreateBuilder(args);
@@ -86,11 +85,11 @@
builder.Services.AddSingleton<ISerialPortService, SerialPortService>();
// 娉ㄥ唽 SerialPortTestService锛屽苟娉ㄥ叆 ISerialPortService
builder.Services.AddSingleton<SerialPortTestService>(sp =>
{
    var serialPortService = sp.GetRequiredService<ISerialPortService>();
    return new SerialPortTestService("COM3", serialPortService);
});
//builder.Services.AddSingleton<SerialPortTestJob>(sp =>
//{
//    var serialPortService = sp.GetRequiredService<ISerialPortService>();
//    return new SerialPortTestJob("COM3", serialPortService);
//});
//// 娉ㄥ叆 SerialPortService
//builder.Services.AddScoped<ISerialPortService, SerialPortService>();