SH.Extensions 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package SH.Extensions --version 1.0.3
                    
NuGet\Install-Package SH.Extensions -Version 1.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SH.Extensions" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SH.Extensions" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="SH.Extensions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SH.Extensions --version 1.0.3
                    
#r "nuget: SH.Extensions, 1.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SH.Extensions@1.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SH.Extensions&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=SH.Extensions&version=1.0.3
                    
Install as a Cake Tool

使用说明

NLog

    builder.AddSHNlog();

查看 项目中 是否存在 nlog.config 是否存在 不存在添加

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      autoReload="true"
      throwExceptions="false"
      internalLogLevel="Off" >

  
  <extensions>
    <add assembly="NLog.Web.AspNetCore"/>
  </extensions>

  
  <targets>
    
    <target xsi:type="File" name="allfile" fileName="logs\nlog-AspNetCore-all-${shortdate}.log"
            layout="${longdate}|${event-properties:item=EventId:whenEmpty=0}|${level:uppercase=true}|${logger}|${message} ${exception:format=tostring}" />

    
    <target xsi:type="File" name="ownFile-web" fileName="logs\nlog-AspNetCore-own-${shortdate}.log"
            layout="${longdate}|${event-properties:item=EventId:whenEmpty=0}|${level:uppercase=true}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />

    
    <target xsi:type="ColoredConsole" name="lifetimeConsole" layout="${MicrosoftConsoleLayout}" useDefaultRowHighlightingRules="true" >
      <highlight-word foregroundColor="DarkGreen" regex="^info" />
      <highlight-word foregroundColor="Yellow" regex="^warn" />
      <highlight-word foregroundColor="Black" backgroundColor="Red" regex="^fail" />
      <highlight-word foregroundColor="White" backgroundColor="Red" regex="^crit" />
    </target>
  </targets>

  
  <rules>
    
    <logger name="*" minlevel="Info" writeTo="allfile" />
    
    <logger name="Microsoft.*" maxlevel="Info" final="true" />
    <logger name="System.Net.Http.*" maxlevel="Info" final="true" />
    <logger name="*" minlevel="Info" writeTo="lifetimeConsole" />
    
    <logger name="*Volo.Abp.*" maxlevel="Info" final="true" />
    <logger name="*" minlevel="Info" writeTo="ownFile-web" />
  </rules>
</nlog>

缓存 处理

     builder.Services.AddShCache("connnstring 中的rediskey")
  

JWT 认证处理

              var tokenparambuider = new DefaultSHAuthTokenValidationParametersBuilder();
            tokenparambuider.SetIssuerSigningKey("123456789978654321")
                .SetAudience("http://localhost:5259")
                .SetClaimsIssuer("Api");
            builder.Services.AddSHAuth(tokenparambuider);


***********************   Token 生成 ****************************

            string token = ShAuthServiceConllectionExtensions.GenerateToken("", "");

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.4 243 6/21/2023
1.0.3 217 6/21/2023
1.0.2 229 6/13/2023
1.0.1 229 6/13/2023
1.0.0 213 6/13/2023