diff --git a/README.en.md b/README.en.md index c02304f..26f53f9 100644 --- a/README.en.md +++ b/README.en.md @@ -382,7 +382,6 @@ Due to access many different equipment vendor's agreement, but each protocol doc | Install-Package JT808.Protocol.Extensions.JT1078 | ![JT808.Protocol.Extensions.JT1078](https://img.shields.io/nuget/v/JT808.Protocol.Extensions.JT1078.svg) | ![JT808.Protocol.Extensions.JT1078](https://img.shields.io/nuget/vpre/JT808.Protocol.Extensions.JT1078.svg)|![JT808](https://img.shields.io/nuget/dt/JT808.Protocol.Extensions.JT1078.svg) |JT1078 extension JT808| | Install-Package JT808.Protocol.Extensions.SuBiao| ![JT808.Protocol.Extensions.SuBiao](https://img.shields.io/nuget/v/JT808.Protocol.Extensions.SuBiao.svg) | ![JT808.Protocol.Extensions.SuBiao](https://img.shields.io/nuget/vpre/JT808.Protocol.Extensions.SuBiao.svg)|![JT808](https://img.shields.io/nuget/dt/JT808.Protocol.Extensions.SuBiao.svg) |Active Safety (Su Biao) extension JT808| | Install-Package JT808.Protocol.Extensions.YueBiao| ![JT808.Protocol.Extensions.YueBiao](https://img.shields.io/nuget/v/JT808.Protocol.Extensions.YueBiao.svg) | ![JT808.Protocol.Extensions.YueBiao](https://img.shields.io/nuget/vpre/JT808.Protocol.Extensions.YueBiao.svg)|![JT808](https://img.shields.io/nuget/dt/JT808.Protocol.Extensions.YueBiao.svg) |Active Safety (Yue Biao) extension JT808| -| Install-Package JT808.Protocol.DependencyInjection| ![JT808.Protocol.DependencyInjection](https://img.shields.io/nuget/v/JT808.Protocol.DependencyInjection.svg) | ![JT808.Protocol.DependencyInjection](https://img.shields.io/nuget/vpre/JT808.Protocol.DependencyInjection.svg)|![JT808.Protocol.DependencyInjection](https://img.shields.io/nuget/dt/JT808.Protocol.DependencyInjection.svg) |JT808 DependencyInjection| ## Using BenchmarkDotNet performance test reports (just for fun, not to be taken seriously) diff --git a/README.md b/README.md index 61305ee..997758d 100644 --- a/README.md +++ b/README.md @@ -398,7 +398,6 @@ JT808Serializer DT2JT808Serializer = new JT808Serializer(DT2JT808Config); | Install-Package JT808.Protocol.Extensions.JT1078 | ![JT808.Protocol.Extensions.JT1078](https://img.shields.io/nuget/v/JT808.Protocol.Extensions.JT1078.svg) | ![JT808.Protocol.Extensions.JT1078](https://img.shields.io/nuget/vpre/JT808.Protocol.Extensions.JT1078.svg) | ![JT808](https://img.shields.io/nuget/dt/JT808.Protocol.Extensions.JT1078.svg) | JT1078 扩展 JT808 | | Install-Package JT808.Protocol.Extensions.SuBiao | ![JT808.Protocol.Extensions.SuBiao](https://img.shields.io/nuget/v/JT808.Protocol.Extensions.SuBiao.svg) | ![JT808.Protocol.Extensions.SuBiao](https://img.shields.io/nuget/vpre/JT808.Protocol.Extensions.SuBiao.svg) | ![JT808](https://img.shields.io/nuget/dt/JT808.Protocol.Extensions.SuBiao.svg) | 主动安全(苏标)扩展 JT808 | | Install-Package JT808.Protocol.Extensions.YueBiao | ![JT808.Protocol.Extensions.YueBiao](https://img.shields.io/nuget/v/JT808.Protocol.Extensions.YueBiao.svg) | ![JT808.Protocol.Extensions.YueBiao](https://img.shields.io/nuget/vpre/JT808.Protocol.Extensions.YueBiao.svg) | ![JT808](https://img.shields.io/nuget/dt/JT808.Protocol.Extensions.YueBiao.svg) | 主动安全(粤标)扩展 JT808 | -| Install-Package JT808.Protocol.DependencyInjection | ![JT808.Protocol.DependencyInjection](https://img.shields.io/nuget/v/JT808.Protocol.DependencyInjection.svg) | ![JT808.Protocol.DependencyInjection](https://img.shields.io/nuget/vpre/JT808.Protocol.DependencyInjection.svg) | ![JT808.Protocol.DependencyInjection](https://img.shields.io/nuget/dt/JT808.Protocol.DependencyInjection.svg) | JT808 依赖注入扩展 | ## 使用 BenchmarkDotNet 性能测试报告(只是玩玩,不能当真) diff --git a/publish.bat b/publish.bat index f7acbb4..0900f92 100644 --- a/publish.bat +++ b/publish.bat @@ -1,5 +1,4 @@ dotnet pack .\src\JT808.Protocol\JT808.Protocol.csproj -c Release --output nupkgs -dotnet pack .\src\JT808.Protocol.Extensions\JT808.Protocol.DependencyInjection\JT808.Protocol.DependencyInjection.csproj -c Release --output nupkgs dotnet pack .\src\JT808.Protocol.Extensions\JT808.Protocol.Extensions.JT1078\JT808.Protocol.Extensions.JT1078.csproj -c Release --output nupkgs dotnet pack .\src\JT808.Protocol.Extensions\JT808.Protocol.Extensions.SuBiao\JT808.Protocol.Extensions.SuBiao.csproj -c Release --output nupkgs dotnet pack .\src\JT808.Protocol.Extensions\JT808.Protocol.Extensions.YueBiao\JT808.Protocol.Extensions.YueBiao.csproj -c Release --output nupkgs diff --git a/src/Info.props b/src/Info.props index d05eb67..6b75e64 100644 --- a/src/Info.props +++ b/src/Info.props @@ -8,7 +8,7 @@ https://github.com/SmallChi/JT808 https://github.com/SmallChi/JT808/blob/master/LICENSE https://github.com/SmallChi/JT808/blob/master/LICENSE - 2.6.2-preview4 + 2.6.2-preview5 enable LICENSE true diff --git a/src/JT808.Protocol.Benchmark/JT808.Protocol.Benchmark.csproj b/src/JT808.Protocol.Benchmark/JT808.Protocol.Benchmark.csproj index 06418bc..cac62fd 100644 --- a/src/JT808.Protocol.Benchmark/JT808.Protocol.Benchmark.csproj +++ b/src/JT808.Protocol.Benchmark/JT808.Protocol.Benchmark.csproj @@ -14,14 +14,13 @@ - - + + - diff --git a/src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/DefaultDIBuilder.cs b/src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/DefaultDIBuilder.cs deleted file mode 100644 index ad06e46..0000000 --- a/src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/DefaultDIBuilder.cs +++ /dev/null @@ -1,33 +0,0 @@ -using JT808.Protocol.Interfaces; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Text; - -namespace JT808.Protocol.DependencyInjection -{ - /// - /// 默认JT808构造器 - /// - class DefaultDIBuilder : IJT808DIBuilder - { - /// - /// JT808配置 - /// - public IJT808Config Config { get; } - /// - /// DI ServiceCollection - /// - public IServiceCollection Services { get; } - /// - /// - /// - /// - /// - public DefaultDIBuilder(IServiceCollection services,IJT808Config config) - { - Config = config; - Services = services; - } - } -} diff --git a/src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/IJT808DIBuilder.cs b/src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/IJT808DIBuilder.cs deleted file mode 100644 index acdc45e..0000000 --- a/src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/IJT808DIBuilder.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace JT808.Protocol.DependencyInjection -{ - /// - /// JT808 DI Builder - /// - public interface IJT808DIBuilder: IJT808Builder - { - /// - /// 服务注册 - /// - IServiceCollection Services { get; } - } -} diff --git a/src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/JT808.Protocol.DependencyInjection.csproj b/src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/JT808.Protocol.DependencyInjection.csproj deleted file mode 100644 index 331d610..0000000 --- a/src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/JT808.Protocol.DependencyInjection.csproj +++ /dev/null @@ -1,29 +0,0 @@ - - - - JT808.Protocol.DependencyInjection - JT808.Protocol.DependencyInjection - - JT808.Protocol.DependencyInjection. - - - JT808.Protocol.DependencyInjection. - - JT808.Protocol.DependencyInjection.xml - - - - - - - - - - - - - - - - - diff --git a/src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/JT808.Protocol.DependencyInjection.xml b/src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/JT808.Protocol.DependencyInjection.xml deleted file mode 100644 index 564b0a7..0000000 --- a/src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/JT808.Protocol.DependencyInjection.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - JT808.Protocol.DependencyInjection - - - - - 默认JT808构造器 - - - - - JT808配置 - - - - - DI ServiceCollection - - - - - - - - - - - - JT808 DI Builder - - - - - 服务注册 - - - - - JT808 DI扩展 - JT808 DependencyInjectionExtensions - - - - - 注册808配置 - - - - - - - - 注册808配置 - - - - - - - - 注册808配置 - - - - - - - - 注册808配置 - - - - - - - - 注册808配置 - - - - - - diff --git a/src/JT808.Protocol.Extensions/JT808.Protocol.Extensions.JT1078.Test/JT808.Protocol.Extensions.JT1078.Test.csproj b/src/JT808.Protocol.Extensions/JT808.Protocol.Extensions.JT1078.Test/JT808.Protocol.Extensions.JT1078.Test.csproj index b51e5b8..3fae08e 100644 --- a/src/JT808.Protocol.Extensions/JT808.Protocol.Extensions.JT1078.Test/JT808.Protocol.Extensions.JT1078.Test.csproj +++ b/src/JT808.Protocol.Extensions/JT808.Protocol.Extensions.JT1078.Test/JT808.Protocol.Extensions.JT1078.Test.csproj @@ -7,7 +7,7 @@ - + all @@ -16,7 +16,6 @@ - diff --git a/src/JT808.Protocol.Extensions/JT808.Protocol.Extensions.SuBiao.Test/JT808.Protocol.Extensions.SuBiao.Test.csproj b/src/JT808.Protocol.Extensions/JT808.Protocol.Extensions.SuBiao.Test/JT808.Protocol.Extensions.SuBiao.Test.csproj index 7962b76..73caa78 100644 --- a/src/JT808.Protocol.Extensions/JT808.Protocol.Extensions.SuBiao.Test/JT808.Protocol.Extensions.SuBiao.Test.csproj +++ b/src/JT808.Protocol.Extensions/JT808.Protocol.Extensions.SuBiao.Test/JT808.Protocol.Extensions.SuBiao.Test.csproj @@ -8,7 +8,7 @@ - + all @@ -17,7 +17,6 @@ - diff --git a/src/JT808.Protocol.Extensions/JT808.Protocol.Extensions.YueBiao.Test/JT808.Protocol.Extensions.YueBiao.Test.csproj b/src/JT808.Protocol.Extensions/JT808.Protocol.Extensions.YueBiao.Test/JT808.Protocol.Extensions.YueBiao.Test.csproj index 586e9af..a0f1ecd 100644 --- a/src/JT808.Protocol.Extensions/JT808.Protocol.Extensions.YueBiao.Test/JT808.Protocol.Extensions.YueBiao.Test.csproj +++ b/src/JT808.Protocol.Extensions/JT808.Protocol.Extensions.YueBiao.Test/JT808.Protocol.Extensions.YueBiao.Test.csproj @@ -8,20 +8,19 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all - diff --git a/src/JT808.Protocol.Test/JT808.Protocol.Test.csproj b/src/JT808.Protocol.Test/JT808.Protocol.Test.csproj index 9282414..31672b9 100644 --- a/src/JT808.Protocol.Test/JT808.Protocol.Test.csproj +++ b/src/JT808.Protocol.Test/JT808.Protocol.Test.csproj @@ -108,7 +108,7 @@ - + @@ -126,7 +126,6 @@ - diff --git a/src/JT808.Protocol.sln b/src/JT808.Protocol.sln index a20dff6..acd871a 100644 --- a/src/JT808.Protocol.sln +++ b/src/JT808.Protocol.sln @@ -33,8 +33,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT808.Protocol.Extensions.S EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT808.Protocol.Extensions.SuBiao.Test", "JT808.Protocol.Extensions\JT808.Protocol.Extensions.SuBiao.Test\JT808.Protocol.Extensions.SuBiao.Test.csproj", "{BEE2E12D-C123-4682-AB7E-210C2BF564B3}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JT808.Protocol.DependencyInjection", "JT808.Protocol.Extensions\JT808.Protocol.DependencyInjection\JT808.Protocol.DependencyInjection.csproj", "{7EB01F74-DFDB-4733-8F15-5785A9ED7DBD}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -77,10 +75,6 @@ Global {BEE2E12D-C123-4682-AB7E-210C2BF564B3}.Debug|Any CPU.Build.0 = Debug|Any CPU {BEE2E12D-C123-4682-AB7E-210C2BF564B3}.Release|Any CPU.ActiveCfg = Release|Any CPU {BEE2E12D-C123-4682-AB7E-210C2BF564B3}.Release|Any CPU.Build.0 = Release|Any CPU - {7EB01F74-DFDB-4733-8F15-5785A9ED7DBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7EB01F74-DFDB-4733-8F15-5785A9ED7DBD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7EB01F74-DFDB-4733-8F15-5785A9ED7DBD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7EB01F74-DFDB-4733-8F15-5785A9ED7DBD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -92,7 +86,6 @@ Global {4984E375-4B55-4188-A94E-844B694BBA5C} = {3A0EEA9A-9667-4386-BB46-4A9CB319CE30} {001ECBA0-CF17-40B0-B983-B7AE824B8050} = {3A0EEA9A-9667-4386-BB46-4A9CB319CE30} {BEE2E12D-C123-4682-AB7E-210C2BF564B3} = {3A0EEA9A-9667-4386-BB46-4A9CB319CE30} - {7EB01F74-DFDB-4733-8F15-5785A9ED7DBD} = {3A0EEA9A-9667-4386-BB46-4A9CB319CE30} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {D58CCAA8-ED94-4048-A6DE-55A84814DF17} diff --git a/src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/DependencyInjectionExtensions.cs b/src/JT808.Protocol/DependencyInjectionExtensions.cs similarity index 69% rename from src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/DependencyInjectionExtensions.cs rename to src/JT808.Protocol/DependencyInjectionExtensions.cs index 6f6925f..674201e 100644 --- a/src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/DependencyInjectionExtensions.cs +++ b/src/JT808.Protocol/DependencyInjectionExtensions.cs @@ -1,5 +1,4 @@ -using JT808.Protocol.DependencyInjection; -using JT808.Protocol.Interfaces; +using JT808.Protocol.Interfaces; using JT808.Protocol.Internal; using Microsoft.Extensions.DependencyInjection; using System; @@ -20,10 +19,10 @@ namespace JT808.Protocol /// /// /// - public static IJT808DIBuilder AddJT808Configure(this IServiceCollection services, IJT808Config jT808Config) + public static IJT808Builder AddJT808Configure(this IServiceCollection services, IJT808Config jT808Config) { services.AddSingleton(jT808Config.GetType(), jT808Config); - return new DefaultDIBuilder(services,jT808Config); + return new DefaultBuilder(services,jT808Config); } /// /// 注册808配置 @@ -31,7 +30,7 @@ namespace JT808.Protocol /// /// /// - public static IJT808DIBuilder AddJT808Configure(this IJT808DIBuilder builder, IJT808Config jT808Config) + public static IJT808Builder AddJT808Configure(this IJT808Builder builder, IJT808Config jT808Config) { builder.Services.AddSingleton(jT808Config.GetType(), jT808Config); return builder; @@ -42,11 +41,11 @@ namespace JT808.Protocol /// /// /// - public static IJT808DIBuilder AddJT808Configure(this IServiceCollection services)where TJT808Config : IJT808Config,new() + public static IJT808Builder AddJT808Configure(this IServiceCollection services)where TJT808Config : IJT808Config,new() { var config = new TJT808Config(); services.AddSingleton(typeof(TJT808Config), config); - return new DefaultDIBuilder(services, config); + return new DefaultBuilder(services, config); } /// /// 注册808配置 @@ -54,7 +53,7 @@ namespace JT808.Protocol /// /// /// - public static IJT808DIBuilder AddJT808Configure(this IJT808DIBuilder builder) where TJT808Config : IJT808Config, new() + public static IJT808Builder AddJT808Configure(this IJT808Builder builder) where TJT808Config : IJT808Config, new() { var config = new TJT808Config(); builder.Services.AddSingleton(typeof(TJT808Config), config); @@ -65,11 +64,11 @@ namespace JT808.Protocol /// /// /// - public static IJT808DIBuilder AddJT808Configure(this IServiceCollection services) + public static IJT808Builder AddJT808Configure(this IServiceCollection services) { DefaultGlobalConfig config = new DefaultGlobalConfig(); services.AddSingleton(config); - return new DefaultDIBuilder(services,config); + return new DefaultBuilder(services,config); } } } diff --git a/src/JT808.Protocol/IJT808Builder.cs b/src/JT808.Protocol/IJT808Builder.cs index 06d779d..1c5ad67 100644 --- a/src/JT808.Protocol/IJT808Builder.cs +++ b/src/JT808.Protocol/IJT808Builder.cs @@ -1,4 +1,5 @@ using JT808.Protocol.Interfaces; +using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Generic; using System.Text; @@ -14,5 +15,9 @@ namespace JT808.Protocol /// JT808配置 /// IJT808Config Config { get; } + /// + /// DI ServiceCollection + /// + IServiceCollection Services { get; } } } diff --git a/src/JT808.Protocol/Internal/DefaultBuilder.cs b/src/JT808.Protocol/Internal/DefaultBuilder.cs index 0a8c38f..2205cae 100644 --- a/src/JT808.Protocol/Internal/DefaultBuilder.cs +++ b/src/JT808.Protocol/Internal/DefaultBuilder.cs @@ -1,4 +1,5 @@ using JT808.Protocol.Interfaces; +using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Generic; using System.Text; @@ -10,6 +11,10 @@ namespace JT808.Protocol.Internal /// class DefaultBuilder : IJT808Builder { + /// + /// DI服务 + /// + public IServiceCollection Services { get; } /// /// JT808配置 /// @@ -17,9 +22,11 @@ namespace JT808.Protocol.Internal /// /// /// + /// /// - public DefaultBuilder(IJT808Config config) + public DefaultBuilder(IServiceCollection services, IJT808Config config) { + Services = services; Config = config; } } diff --git a/src/JT808.Protocol/JT808.Protocol.csproj b/src/JT808.Protocol/JT808.Protocol.csproj index ea4f07c..f5c55fa 100644 --- a/src/JT808.Protocol/JT808.Protocol.csproj +++ b/src/JT808.Protocol/JT808.Protocol.csproj @@ -27,7 +27,6 @@ - @@ -49,10 +48,12 @@ + - + + diff --git a/src/JT808.Protocol/JT808.Protocol.xml b/src/JT808.Protocol/JT808.Protocol.xml index 807f766..39e3de9 100644 --- a/src/JT808.Protocol/JT808.Protocol.xml +++ b/src/JT808.Protocol/JT808.Protocol.xml @@ -15,6 +15,51 @@ 编码之前的写入位置 + + + JT808 DI扩展 + JT808 DependencyInjectionExtensions + + + + + 注册808配置 + + + + + + + + 注册808配置 + + + + + + + + 注册808配置 + + + + + + + + 注册808配置 + + + + + + + + 注册808配置 + + + + 报警标志 @@ -4256,6 +4301,11 @@ JT808配置 + + + DI ServiceCollection + + 全局配置基类 @@ -4943,15 +4993,21 @@ 默认JT808构造器 + + + DI服务 + + JT808配置 - + +