FLSY.Common
1.1.0
dotnet add package FLSY.Common --version 1.1.0
NuGet\Install-Package FLSY.Common -Version 1.1.0
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="FLSY.Common" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FLSY.Common --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: FLSY.Common, 1.1.0"
#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.
// Install FLSY.Common as a Cake Addin #addin nuget:?package=FLSY.Common&version=1.1.0 // Install FLSY.Common as a Cake Tool #tool nuget:?package=FLSY.Common&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
依赖包:已安装
Install-Package Microsoft.Extensions.Configuration -Version 6.0.0
Install-Package Microsoft.Extensions.Configuration.FileExtensions -Version 6.0.0
Install-Package Microsoft.Extensions.Configuration.Json -Version 6.0.0
Install-Package Newtonsoft.Json -Version 13.0.3
Install-Package Portable.BouncyCastle -Version 1.9.0
Install-Package QRCoder -Version 1.4.3
Install-Package SharpZipLib -Version 1.0.22
扩展方法
- 枚举
/// <summary>
/// 返回枚举项的描述信息。
/// </summary>
/// <param name="value">要获取描述信息的枚举项。</param>
/// <returns>枚举想的描述信息。</returns>
static string GetDescription(this Enum value)
- 异常处理
/// <summary>
/// 当action函数返回true,会抛出指定错误消息异常,用于减少if判断
/// </summary>
static T ThrowException<T>(this T value, Func<T, bool> action, string errorMessage, ExceptionTypeEnum exceptionTypeEnum = ExceptionTypeEnum.Exception)
- List集合
/// <summary>
/// 转换成分页模型
/// </summary>
/// <typeparam name="T">泛型集合类型</typeparam>
/// <param name="list"></param>
/// <param name="totalRecord">总记录数</param>
/// <returns></returns>
static PaginationCollection<T> ToPaginationCollection<T>(this IEnumerable<T> list, int totalRecord)
/// <summary>
/// 排序
/// </summary>
/// <typeparam name="TSource">泛型集合类型</typeparam>
/// <typeparam name="TKey">排序属性类型</typeparam>
/// <param name="list"></param>
/// <param name="order">排序属性</param>
/// <param name="sortBy">排序类型:0=降序,1=升序</param>
/// <param name="defaultOrder">默认排序:当排序属性为null|空时使用默认排序</param>
/// <returns></returns>
static IEnumerable<TSource> OrderBy<TSource, TKey>(this IEnumerable<TSource> list, string order, SortByEnum sortBy, Func<TSource, TKey> defaultOrder)
辅助工具类
- ActionResponse:构造统一的返回结果
- Pagination:数据分页模型
- PaginationSearchTime:数据分页模型包含搜索时间
- CryptoUtil:加密工具:用于哈希算法(计算SHA-256、计算MD5)、签名算法(HMAC签名)
- AESHelper:对称加密
- RSAHelper:非对称加密
- ConfigHelper:读取配置文件
- IPAddressApi:根据IP地址获取国家信息
- QRCodeHelper:生成、合成二维码图片
- RandomHelper:生成指定长度的随机数
长整型转字符串LongToStringConverter
在配置服务容器中添加以下代码
public override void ConfigureServices(ServiceConfigurationContext context)
{
var services = context.Services;
services.AddNewtonsoftJson(options =>
{
//长整型序列化为字符串
options.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver();
options.SerializerSettings.Converters.Add(new ABP.Common.LongToStringConverter());
});
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net5.0
- Microsoft.Extensions.Configuration (>= 6.0.0)
- Microsoft.Extensions.Configuration.FileExtensions (>= 6.0.0)
- Microsoft.Extensions.Configuration.Json (>= 6.0.0)
- Newtonsoft.Json (>= 13.0.3)
- Portable.BouncyCastle (>= 1.9.0)
- QRCoder (>= 1.4.3)
- SharpZipLib (>= 1.4.0)
- Victory.Dao (>= 1.0.22)
-
net6.0
- Microsoft.Extensions.Configuration (>= 6.0.0)
- Microsoft.Extensions.Configuration.FileExtensions (>= 6.0.0)
- Microsoft.Extensions.Configuration.Json (>= 6.0.0)
- Newtonsoft.Json (>= 13.0.3)
- Portable.BouncyCastle (>= 1.9.0)
- QRCoder (>= 1.4.3)
- SharpZipLib (>= 1.4.0)
- System.Drawing.Common (>= 7.0.0)
- Victory.Dao (>= 1.0.22)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.