qiuyao
2025-02-28 d7ad50a2e9fb4713fd9350ab6475cb1c89060370
ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_Server/Program.cs
@@ -81,8 +81,18 @@
//builder.Services.AddSingleton<SerialPortTestService>(sp =>
//    new SerialPortTestService("COM3")); // è¿™é‡Œå¯ä»¥ä¼ å…¥ä¸²å£å·
// æ³¨å…¥ SerialPortService
builder.Services.AddScoped<ISerialPortService, SerialPortService>();
// æ³¨å†Œ ISerialPortService å®žçް
builder.Services.AddSingleton<ISerialPortService, SerialPortService>();
// æ³¨å†Œ SerialPortTestService,并注入 ISerialPortService
//builder.Services.AddSingleton<SerialPortTestJob>(sp =>
//{
//    var serialPortService = sp.GetRequiredService<ISerialPortService>();
//    return new SerialPortTestJob("COM3", serialPortService);
//});
//// æ³¨å…¥ SerialPortService
//builder.Services.AddScoped<ISerialPortService, SerialPortService>();
builder.Services.AddSession();