NICWebApi.Extensions.Mapper
1.0.41
dotnet add package NICWebApi.Extensions.Mapper --version 1.0.41
NuGet\Install-Package NICWebApi.Extensions.Mapper -Version 1.0.41
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="NICWebApi.Extensions.Mapper" Version="1.0.41" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NICWebApi.Extensions.Mapper" Version="1.0.41" />
<PackageReference Include="NICWebApi.Extensions.Mapper" />
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 NICWebApi.Extensions.Mapper --version 1.0.41
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NICWebApi.Extensions.Mapper, 1.0.41"
#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 NICWebApi.Extensions.Mapper@1.0.41
#: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=NICWebApi.Extensions.Mapper&version=1.0.41
#tool nuget:?package=NICWebApi.Extensions.Mapper&version=1.0.41
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
NICWebApi.Extensions.Mapper
NICWebApi.Extensions.Mapper 是独立的对象映射扩展库,基于 Mapster 提供可配置、可隔离、可验证的对象映射注册能力。
它不负责动态 API、统一返回格式、JWT 认证、HTTP 请求日志、Swagger UI 或业务权限。
快速开始
builder.Services.AddObjectMapper();
默认会扫描已加载业务程序集和入口程序集中的 Mapster IRegister;需要缩小扫描范围时再传入指定程序集。
使用统一抽象:
using NICWebApi.Extensions.Mapper.Abstractions;
public sealed class UserAppService
{
private readonly IObjectMapper _mapper;
public UserAppService(IObjectMapper mapper)
{
_mapper = mapper;
}
public UserDto ToDto(User user)
{
return _mapper.Map<UserDto>(user);
}
}
也可以使用语义化扩展方法:
using NICWebApi.Extensions.Mapper.Extensions;
var dto = user.MapTo<UserDto>(_mapper);
var list = users.MapToList<UserDto>(_mapper);
user.MapTo(existingDto, _mapper);
自定义 Mapster 配置:
builder.Services.AddObjectMapper(config =>
{
config.NewConfig<User, UserDto>()
.Map(destination => destination.DisplayName, source => source.Name);
}, typeof(Program).Assembly);
更多内容:
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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 is compatible. 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 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
- Mapster (>= 7.4.0)
- Mapster.DependencyInjection (>= 1.0.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.5)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.5)
- Microsoft.Extensions.DependencyInjection (>= 9.0.5)
-
net8.0
- Mapster (>= 7.4.0)
- Mapster.DependencyInjection (>= 1.0.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.5)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.5)
- Microsoft.Extensions.DependencyInjection (>= 9.0.5)
-
net9.0
- Mapster (>= 7.4.0)
- Mapster.DependencyInjection (>= 1.0.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.5)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.5)
- Microsoft.Extensions.DependencyInjection (>= 9.0.5)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on NICWebApi.Extensions.Mapper:
| Package | Downloads |
|---|---|
|
NICWebApi.Extensions.AspNetCore
NICWebApi ASP.NET Core 一键集成扩展包,组合 DynamicAPI、RESTfulResult、JWT、Mapper、DependencyInjection、Http、RemoteRequest、Caching、Idempotency、Schedule、Messaging 和 OperationLogging 的默认注册。 |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.41 | 149 | 7/7/2026 |