Selaa lähdekoodia

1.将DI整合到一起,分开在一起比较难用

tags/v2.6.2
smallchi(Koike) 1 vuosi sitten
vanhempi
commit
24753fb5c3
19 muutettua tiedostoa jossa 90 lisäystä ja 204 poistoa
  1. +0
    -1
      README.en.md
  2. +0
    -1
      README.md
  3. +0
    -1
      publish.bat
  4. +1
    -1
      src/Info.props
  5. +2
    -3
      src/JT808.Protocol.Benchmark/JT808.Protocol.Benchmark.csproj
  6. +0
    -33
      src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/DefaultDIBuilder.cs
  7. +0
    -20
      src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/IJT808DIBuilder.cs
  8. +0
    -29
      src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/JT808.Protocol.DependencyInjection.csproj
  9. +0
    -85
      src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/JT808.Protocol.DependencyInjection.xml
  10. +1
    -2
      src/JT808.Protocol.Extensions/JT808.Protocol.Extensions.JT1078.Test/JT808.Protocol.Extensions.JT1078.Test.csproj
  11. +1
    -2
      src/JT808.Protocol.Extensions/JT808.Protocol.Extensions.SuBiao.Test/JT808.Protocol.Extensions.SuBiao.Test.csproj
  12. +2
    -3
      src/JT808.Protocol.Extensions/JT808.Protocol.Extensions.YueBiao.Test/JT808.Protocol.Extensions.YueBiao.Test.csproj
  13. +1
    -2
      src/JT808.Protocol.Test/JT808.Protocol.Test.csproj
  14. +0
    -7
      src/JT808.Protocol.sln
  15. +9
    -10
      src/JT808.Protocol/DependencyInjectionExtensions.cs
  16. +5
    -0
      src/JT808.Protocol/IJT808Builder.cs
  17. +8
    -1
      src/JT808.Protocol/Internal/DefaultBuilder.cs
  18. +3
    -2
      src/JT808.Protocol/JT808.Protocol.csproj
  19. +57
    -1
      src/JT808.Protocol/JT808.Protocol.xml

+ 0
- 1
README.en.md Näytä tiedosto

@@ -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)



+ 0
- 1
README.md Näytä tiedosto

@@ -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 性能测试报告(只是玩玩,不能当真)



+ 0
- 1
publish.bat Näytä tiedosto

@@ -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


+ 1
- 1
src/Info.props Näytä tiedosto

@@ -8,7 +8,7 @@
<PackageProjectUrl>https://github.com/SmallChi/JT808</PackageProjectUrl>
<licenseUrl>https://github.com/SmallChi/JT808/blob/master/LICENSE</licenseUrl>
<license>https://github.com/SmallChi/JT808/blob/master/LICENSE</license>
<Version>2.6.2-preview4</Version>
<Version>2.6.2-preview5</Version>
<ImplicitUsings>enable</ImplicitUsings>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>


+ 2
- 3
src/JT808.Protocol.Benchmark/JT808.Protocol.Benchmark.csproj Näytä tiedosto

@@ -14,14 +14,13 @@
<None Remove="ReportTest\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.2" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.5" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.5" />
<PackageReference Include="NETStandard.Library" Version="2.0.3" />
<PackageReference Include="System.Buffers" Version="4.5.1" />
<PackageReference Include="System.Memory" Version="4.5.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\JT808.Protocol.Extensions\JT808.Protocol.DependencyInjection\JT808.Protocol.DependencyInjection.csproj" />
<ProjectReference Include="..\JT808.Protocol\JT808.Protocol.csproj" />
</ItemGroup>
</Project>

+ 0
- 33
src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/DefaultDIBuilder.cs Näytä tiedosto

@@ -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
{
/// <summary>
/// 默认JT808构造器
/// </summary>
class DefaultDIBuilder : IJT808DIBuilder
{
/// <summary>
/// JT808配置
/// </summary>
public IJT808Config Config { get; }
/// <summary>
/// DI ServiceCollection
/// </summary>
public IServiceCollection Services { get; }
/// <summary>
///
/// </summary>
/// <param name="services"></param>
/// <param name="config"></param>
public DefaultDIBuilder(IServiceCollection services,IJT808Config config)
{
Config = config;
Services = services;
}
}
}

+ 0
- 20
src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/IJT808DIBuilder.cs Näytä tiedosto

@@ -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
{
/// <summary>
/// JT808 DI Builder
/// </summary>
public interface IJT808DIBuilder: IJT808Builder
{
/// <summary>
/// 服务注册
/// </summary>
IServiceCollection Services { get; }
}
}

+ 0
- 29
src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/JT808.Protocol.DependencyInjection.csproj Näytä tiedosto

@@ -1,29 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\Info.props" />
<PropertyGroup>
<PackageId>JT808.Protocol.DependencyInjection</PackageId>
<Product>JT808.Protocol.DependencyInjection</Product>
<Description>
JT808.Protocol.DependencyInjection.
</Description>
<PackageReleaseNotes>
JT808.Protocol.DependencyInjection.
</PackageReleaseNotes>
<DocumentationFile>JT808.Protocol.DependencyInjection.xml</DocumentationFile>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\..\LICENSE" Pack="true" PackagePath="" />
<None Include="..\..\..\README.md" Pack="true" PackagePath="" />
<None Include="..\..\..\README.en.md" Pack="true" PackagePath="" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\JT808.Protocol\JT808.Protocol.csproj" />
</ItemGroup>

</Project>

+ 0
- 85
src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/JT808.Protocol.DependencyInjection.xml Näytä tiedosto

@@ -1,85 +0,0 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>JT808.Protocol.DependencyInjection</name>
</assembly>
<members>
<member name="T:JT808.Protocol.DependencyInjection.DefaultDIBuilder">
<summary>
默认JT808构造器
</summary>
</member>
<member name="P:JT808.Protocol.DependencyInjection.DefaultDIBuilder.Config">
<summary>
JT808配置
</summary>
</member>
<member name="P:JT808.Protocol.DependencyInjection.DefaultDIBuilder.Services">
<summary>
DI ServiceCollection
</summary>
</member>
<member name="M:JT808.Protocol.DependencyInjection.DefaultDIBuilder.#ctor(Microsoft.Extensions.DependencyInjection.IServiceCollection,JT808.Protocol.IJT808Config)">
<summary>
</summary>
<param name="services"></param>
<param name="config"></param>
</member>
<member name="T:JT808.Protocol.DependencyInjection.IJT808DIBuilder">
<summary>
JT808 DI Builder
</summary>
</member>
<member name="P:JT808.Protocol.DependencyInjection.IJT808DIBuilder.Services">
<summary>
服务注册
</summary>
</member>
<member name="T:JT808.Protocol.DependencyInjectionExtensions">
<summary>
JT808 DI扩展
JT808 DependencyInjectionExtensions
</summary>
</member>
<member name="M:JT808.Protocol.DependencyInjectionExtensions.AddJT808Configure(Microsoft.Extensions.DependencyInjection.IServiceCollection,JT808.Protocol.IJT808Config)">
<summary>
注册808配置
</summary>
<param name="services"></param>
<param name="jT808Config"></param>
<returns></returns>
</member>
<member name="M:JT808.Protocol.DependencyInjectionExtensions.AddJT808Configure(JT808.Protocol.DependencyInjection.IJT808DIBuilder,JT808.Protocol.IJT808Config)">
<summary>
注册808配置
</summary>
<param name="builder"></param>
<param name="jT808Config"></param>
<returns></returns>
</member>
<member name="M:JT808.Protocol.DependencyInjectionExtensions.AddJT808Configure``1(Microsoft.Extensions.DependencyInjection.IServiceCollection)">
<summary>
注册808配置
</summary>
<typeparam name="TJT808Config"></typeparam>
<param name="services"></param>
<returns></returns>
</member>
<member name="M:JT808.Protocol.DependencyInjectionExtensions.AddJT808Configure``1(JT808.Protocol.DependencyInjection.IJT808DIBuilder)">
<summary>
注册808配置
</summary>
<typeparam name="TJT808Config"></typeparam>
<param name="builder"></param>
<returns></returns>
</member>
<member name="M:JT808.Protocol.DependencyInjectionExtensions.AddJT808Configure(Microsoft.Extensions.DependencyInjection.IServiceCollection)">
<summary>
注册808配置
</summary>
<param name="services"></param>
<returns></returns>
</member>
</members>
</doc>

+ 1
- 2
src/JT808.Protocol.Extensions/JT808.Protocol.Extensions.JT1078.Test/JT808.Protocol.Extensions.JT1078.Test.csproj Näytä tiedosto

@@ -7,7 +7,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.1" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
@@ -16,7 +16,6 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\JT808.Protocol.DependencyInjection\JT808.Protocol.DependencyInjection.csproj" />
<ProjectReference Include="..\JT808.Protocol.Extensions.JT1078\JT808.Protocol.Extensions.JT1078.csproj" />
</ItemGroup>



+ 1
- 2
src/JT808.Protocol.Extensions/JT808.Protocol.Extensions.SuBiao.Test/JT808.Protocol.Extensions.SuBiao.Test.csproj Näytä tiedosto

@@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.1" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
@@ -17,7 +17,6 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\JT808.Protocol.DependencyInjection\JT808.Protocol.DependencyInjection.csproj" />
<ProjectReference Include="..\JT808.Protocol.Extensions.SuBiao\JT808.Protocol.Extensions.SuBiao.csproj" />
</ItemGroup>



+ 2
- 3
src/JT808.Protocol.Extensions/JT808.Protocol.Extensions.YueBiao.Test/JT808.Protocol.Extensions.YueBiao.Test.csproj Näytä tiedosto

@@ -8,20 +8,19 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.1" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\JT808.Protocol.DependencyInjection\JT808.Protocol.DependencyInjection.csproj" />
<ProjectReference Include="..\JT808.Protocol.Extensions.YueBiao\JT808.Protocol.Extensions.YueBiao.csproj" />
</ItemGroup>



+ 1
- 2
src/JT808.Protocol.Test/JT808.Protocol.Test.csproj Näytä tiedosto

@@ -108,7 +108,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.1" />
<PackageReference Include="NETStandard.Library" Version="2.0.3" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
@@ -126,7 +126,6 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\JT808.Protocol.Extensions\JT808.Protocol.DependencyInjection\JT808.Protocol.DependencyInjection.csproj" />
<ProjectReference Include="..\JT808.Protocol\JT808.Protocol.csproj" />
</ItemGroup>



+ 0
- 7
src/JT808.Protocol.sln Näytä tiedosto

@@ -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}


src/JT808.Protocol.Extensions/JT808.Protocol.DependencyInjection/DependencyInjectionExtensions.cs → src/JT808.Protocol/DependencyInjectionExtensions.cs Näytä tiedosto

@@ -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
/// <param name="services"></param>
/// <param name="jT808Config"></param>
/// <returns></returns>
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);
}
/// <summary>
/// 注册808配置
@@ -31,7 +30,7 @@ namespace JT808.Protocol
/// <param name="builder"></param>
/// <param name="jT808Config"></param>
/// <returns></returns>
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
/// <typeparam name="TJT808Config"></typeparam>
/// <param name="services"></param>
/// <returns></returns>
public static IJT808DIBuilder AddJT808Configure<TJT808Config>(this IServiceCollection services)where TJT808Config : IJT808Config,new()
public static IJT808Builder AddJT808Configure<TJT808Config>(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);
}
/// <summary>
/// 注册808配置
@@ -54,7 +53,7 @@ namespace JT808.Protocol
/// <typeparam name="TJT808Config"></typeparam>
/// <param name="builder"></param>
/// <returns></returns>
public static IJT808DIBuilder AddJT808Configure<TJT808Config>(this IJT808DIBuilder builder) where TJT808Config : IJT808Config, new()
public static IJT808Builder AddJT808Configure<TJT808Config>(this IJT808Builder builder) where TJT808Config : IJT808Config, new()
{
var config = new TJT808Config();
builder.Services.AddSingleton(typeof(TJT808Config), config);
@@ -65,11 +64,11 @@ namespace JT808.Protocol
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
public static IJT808DIBuilder AddJT808Configure(this IServiceCollection services)
public static IJT808Builder AddJT808Configure(this IServiceCollection services)
{
DefaultGlobalConfig config = new DefaultGlobalConfig();
services.AddSingleton<IJT808Config>(config);
return new DefaultDIBuilder(services,config);
return new DefaultBuilder(services,config);
}
}
}

+ 5
- 0
src/JT808.Protocol/IJT808Builder.cs Näytä tiedosto

@@ -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配置
/// </summary>
IJT808Config Config { get; }
/// <summary>
/// DI ServiceCollection
/// </summary>
IServiceCollection Services { get; }
}
}

+ 8
- 1
src/JT808.Protocol/Internal/DefaultBuilder.cs Näytä tiedosto

@@ -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
/// </summary>
class DefaultBuilder : IJT808Builder
{
/// <summary>
/// DI服务
/// </summary>
public IServiceCollection Services { get; }
/// <summary>
/// JT808配置
/// </summary>
@@ -17,9 +22,11 @@ namespace JT808.Protocol.Internal
/// <summary>
///
/// </summary>
/// <param name="services"></param>
/// <param name="config"></param>
public DefaultBuilder(IJT808Config config)
public DefaultBuilder(IServiceCollection services, IJT808Config config)
{
Services = services;
Config = config;
}
}


+ 3
- 2
src/JT808.Protocol/JT808.Protocol.csproj Näytä tiedosto

@@ -27,7 +27,6 @@
</ItemGroup>

<ItemGroup>
<Compile Remove="DependencyInjectionExtensions.cs" />
<Compile Remove="Formatters\JT808HeaderFormatter.cs" />
<Compile Remove="Formatters\JT808HeaderPackageFormatter.cs" />
<Compile Remove="Formatters\JT808PackageFormatter.cs" />
@@ -49,10 +48,12 @@
<PackageReference Include="System.Reflection.Extensions" Version="4.3.0" />
<PackageReference Include="System.Text.Json" Version="7.0.2" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net7' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
</ItemGroup>


+ 57
- 1
src/JT808.Protocol/JT808.Protocol.xml Näytä tiedosto

@@ -15,6 +15,51 @@
编码之前的写入位置
</summary>
</member>
<member name="T:JT808.Protocol.DependencyInjectionExtensions">
<summary>
JT808 DI扩展
JT808 DependencyInjectionExtensions
</summary>
</member>
<member name="M:JT808.Protocol.DependencyInjectionExtensions.AddJT808Configure(Microsoft.Extensions.DependencyInjection.IServiceCollection,JT808.Protocol.IJT808Config)">
<summary>
注册808配置
</summary>
<param name="services"></param>
<param name="jT808Config"></param>
<returns></returns>
</member>
<member name="M:JT808.Protocol.DependencyInjectionExtensions.AddJT808Configure(JT808.Protocol.IJT808Builder,JT808.Protocol.IJT808Config)">
<summary>
注册808配置
</summary>
<param name="builder"></param>
<param name="jT808Config"></param>
<returns></returns>
</member>
<member name="M:JT808.Protocol.DependencyInjectionExtensions.AddJT808Configure``1(Microsoft.Extensions.DependencyInjection.IServiceCollection)">
<summary>
注册808配置
</summary>
<typeparam name="TJT808Config"></typeparam>
<param name="services"></param>
<returns></returns>
</member>
<member name="M:JT808.Protocol.DependencyInjectionExtensions.AddJT808Configure``1(JT808.Protocol.IJT808Builder)">
<summary>
注册808配置
</summary>
<typeparam name="TJT808Config"></typeparam>
<param name="builder"></param>
<returns></returns>
</member>
<member name="M:JT808.Protocol.DependencyInjectionExtensions.AddJT808Configure(Microsoft.Extensions.DependencyInjection.IServiceCollection)">
<summary>
注册808配置
</summary>
<param name="services"></param>
<returns></returns>
</member>
<member name="T:JT808.Protocol.Enums.JT808Alarm">
<summary>
报警标志
@@ -4256,6 +4301,11 @@
JT808配置
</summary>
</member>
<member name="P:JT808.Protocol.IJT808Builder.Services">
<summary>
DI ServiceCollection
</summary>
</member>
<member name="T:JT808.Protocol.Interfaces.GlobalConfigBase">
<summary>
全局配置基类
@@ -4943,15 +4993,21 @@
默认JT808构造器
</summary>
</member>
<member name="P:JT808.Protocol.Internal.DefaultBuilder.Services">
<summary>
DI服务
</summary>
</member>
<member name="P:JT808.Protocol.Internal.DefaultBuilder.Config">
<summary>
JT808配置
</summary>
</member>
<member name="M:JT808.Protocol.Internal.DefaultBuilder.#ctor(JT808.Protocol.IJT808Config)">
<member name="M:JT808.Protocol.Internal.DefaultBuilder.#ctor(Microsoft.Extensions.DependencyInjection.IServiceCollection,JT808.Protocol.IJT808Config)">
<summary>
</summary>
<param name="services"></param>
<param name="config"></param>
</member>
<member name="T:JT808.Protocol.Internal.DefaultGlobalConfig">


Ladataan…
Peruuta
Tallenna