From 721eae3e240306f38c53f9089685e34b61961cac Mon Sep 17 00:00:00 2001
From: yedajiang44 <602830483@qq.com>
Date: Thu, 4 Jul 2024 11:10:01 +0800
Subject: [PATCH] =?UTF-8?q?=E4=B8=B0=E5=AF=8CDI=E6=89=A9=E5=B1=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../DependencyInjectionExtensions.cs | 15 ++++++++++-----
src/JT808.Protocol/JT808.Protocol.xml | 8 +++++---
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/JT808.Protocol/DependencyInjectionExtensions.cs b/src/JT808.Protocol/DependencyInjectionExtensions.cs
index 674201e..36fdd2b 100644
--- a/src/JT808.Protocol/DependencyInjectionExtensions.cs
+++ b/src/JT808.Protocol/DependencyInjectionExtensions.cs
@@ -22,7 +22,7 @@ namespace JT808.Protocol
public static IJT808Builder AddJT808Configure(this IServiceCollection services, IJT808Config jT808Config)
{
services.AddSingleton(jT808Config.GetType(), jT808Config);
- return new DefaultBuilder(services,jT808Config);
+ return new DefaultBuilder(services, jT808Config);
}
///
/// 注册808配置
@@ -41,9 +41,10 @@ namespace JT808.Protocol
///
///
///
- public static IJT808Builder AddJT808Configure(this IServiceCollection services)where TJT808Config : IJT808Config,new()
+ public static IJT808Builder AddJT808Configure(this IServiceCollection services, Action options = null) where TJT808Config : IJT808Config, new()
{
var config = new TJT808Config();
+ options?.Invoke(config);
services.AddSingleton(typeof(TJT808Config), config);
return new DefaultBuilder(services, config);
}
@@ -52,10 +53,12 @@ namespace JT808.Protocol
///
///
///
+ ///
///
- public static IJT808Builder AddJT808Configure(this IJT808Builder builder) where TJT808Config : IJT808Config, new()
+ public static IJT808Builder AddJT808Configure(this IJT808Builder builder, Action options = null) where TJT808Config : IJT808Config, new()
{
var config = new TJT808Config();
+ options?.Invoke(config);
builder.Services.AddSingleton(typeof(TJT808Config), config);
return builder;
}
@@ -63,12 +66,14 @@ namespace JT808.Protocol
/// 注册808配置
///
///
+ ///
///
- public static IJT808Builder AddJT808Configure(this IServiceCollection services)
+ public static IJT808Builder AddJT808Configure(this IServiceCollection services, Action options = null)
{
DefaultGlobalConfig config = new DefaultGlobalConfig();
+ options?.Invoke(config);
services.AddSingleton(config);
- return new DefaultBuilder(services,config);
+ return new DefaultBuilder(services, config);
}
}
}
diff --git a/src/JT808.Protocol/JT808.Protocol.xml b/src/JT808.Protocol/JT808.Protocol.xml
index 39e3de9..268fdb7 100644
--- a/src/JT808.Protocol/JT808.Protocol.xml
+++ b/src/JT808.Protocol/JT808.Protocol.xml
@@ -37,7 +37,7 @@
-
+
注册808配置
@@ -45,19 +45,21 @@
-
+
注册808配置
+
-
+
注册808配置
+