EJoyer.SDK.Common
1.0.1
dotnet add package EJoyer.SDK.Common --version 1.0.1
NuGet\Install-Package EJoyer.SDK.Common -Version 1.0.1
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="EJoyer.SDK.Common" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EJoyer.SDK.Common" Version="1.0.1" />
<PackageReference Include="EJoyer.SDK.Common" />
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 EJoyer.SDK.Common --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EJoyer.SDK.Common, 1.0.1"
#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 EJoyer.SDK.Common@1.0.1
#: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=EJoyer.SDK.Common&version=1.0.1
#tool nuget:?package=EJoyer.SDK.Common&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
EJoyer.SDK.Common
项目概述
EJoyer.SDK.Common 是一个基于 .NET 10.0 的公共基础类库,为 EJoyer SDK 提供统一的 HTTP 客户端基础设施和标准化 API 响应封装。
核心功能:
- 统一响应模型:提供标准化的 API 响应格式,支持操作状态、双语消息(中/英)、消息代码和执行耗时追踪。
- HTTP 客户端基类:基于
IHttpClientFactory的抽象 HTTP 客户端,支持 GET/POST 请求、JSON 自动序列化、API 令牌认证。 - 性能监控:内置
Stopwatch计时器,自动追踪每次操作的执行时间(毫秒级)。
应用场景:
- 构建基于 HTTP 的 REST API 客户端
- 统一处理微服务间的 API 响应格式
- 需要性能监控和诊断的服务调用
- 支持多语言(中英文)消息的应用程序
运行环境
| 项目 | 说明 |
|---|---|
| 开发语言 | C# 13 (.NET 10.0) |
| 运行环境 | .NET 10.0 Runtime |
| 项目类型 | 类库 (Class Library) |
| 技术架构 | SDK 公共基础模块 |
| 可空引用 | 启用 (Nullable Enable) |
| 隐式 Using | 启用 (Implicit Usings Enable) |
核心依赖
| 包名 | 版本 | 说明 |
|---|---|---|
| Microsoft.Extensions.Http | 10.0.0 | HTTP 客户端工厂,管理连接池 |
API 参考
BaseResponse(抽象基类)
| 属性/方法 | 类型 | 说明 |
|---|---|---|
Success |
bool | 操作是否成功 |
Message |
string | 中文消息 |
EMMessage |
string | 英文消息 |
MessageCode |
int | 消息代码 |
ExecuteMilliseconds |
long | 执行耗时(毫秒,只读) |
SetCorrect() |
void | 标记成功并停止计时 |
SetError() |
void | 标记失败并停止计时 |
Stop() |
void | 显式停止计时器 |
APIResponse<T>(泛型响应类)
| 属性 | 类型 | 说明 |
|---|---|---|
Data |
T? | 响应载荷数据(支持 null) |
ApiClientBase(抽象 HTTP 客户端)
| 方法 | 说明 |
|---|---|
GetAsync<T>(uri, apiToken?, ct) |
发送 GET 请求,返回反序列化后的对象 |
PostAsync<TReq, TRes>(uri, content, apiToken?, ct) |
发送 POST 请求,自动序列化请求体 |
许可证
本项目为 EJoyer 平台内部 SDK 组件。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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.
-
net10.0
- Microsoft.Extensions.Http (>= 10.0.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on EJoyer.SDK.Common:
| Package | Downloads |
|---|---|
|
EJoyer.SDK.AddressService
private sdk |
|
|
EJoyer.SDK.ProductService
private sdk |
|
|
EJoyer.SDK.Log
private sdk |
GitHub repositories
This package is not used by any popular GitHub repositories.