| | |
| | | using Microsoft.AspNetCore.Builder; |
| | | using WIDESEA_SerialPortService; |
| | | using WIDESEA_ISerialPortService; |
| | | using WIDESEA_SerialPortTestService; |
| | | |
| | | var builder = WebApplication.CreateBuilder(args); |
| | | |
| | |
| | | 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>(); |