ArkaSoftware.Extensions.ObjectMappers.Abstractions
2.0.0
dotnet add package ArkaSoftware.Extensions.ObjectMappers.Abstractions --version 2.0.0
NuGet\Install-Package ArkaSoftware.Extensions.ObjectMappers.Abstractions -Version 2.0.0
<PackageReference Include="ArkaSoftware.Extensions.ObjectMappers.Abstractions" Version="2.0.0" />
<PackageVersion Include="ArkaSoftware.Extensions.ObjectMappers.Abstractions" Version="2.0.0" />
<PackageReference Include="ArkaSoftware.Extensions.ObjectMappers.Abstractions" />
paket add ArkaSoftware.Extensions.ObjectMappers.Abstractions --version 2.0.0
#r "nuget: ArkaSoftware.Extensions.ObjectMappers.Abstractions, 2.0.0"
#:package ArkaSoftware.Extensions.ObjectMappers.Abstractions@2.0.0
#addin nuget:?package=ArkaSoftware.Extensions.ObjectMappers.Abstractions&version=2.0.0
#tool nuget:?package=ArkaSoftware.Extensions.ObjectMappers.Abstractions&version=2.0.0
ArkaSoftware.Extensions.ObjectMappers.Abstractions
ArkaSoftware.Extensions.ObjectMappers.Abstractions provides a clean and minimal interface for performing object-to-object mapping in .NET applications. This abstraction helps decouple your application logic from specific mapping libraries like AutoMapper, Mapster, etc.
π§ Interface
IMapperAdapter
Defines a generic method for mapping between two types:
public interface IMapperAdapter
{
TDestination Map<TSource, TDestination>(TSource source);
}
π― Why Use This?
Decouple your app from specific mapping tools (AutoMapper, Mapster, etc.)
Enable testability by mocking or faking mapping
Increase portability and flexibility in your architecture
Ideal for Clean Architecture and DDD
π Example Implementation
Hereβs how you could implement it with AutoMapper:
public class AutoMapperAdapter : IMapperAdapter
{
private readonly IMapper _mapper;
public AutoMapperAdapter(IMapper mapper)
{
_mapper = mapper;
}
public TDestination Map<TSource, TDestination>(TSource source)
{
return _mapper.Map<TDestination>(source);
}
}
π§ͺ Testing Example
In tests, you could create a fake or manual implementation:
public class FakeMapperAdapter : IMapperAdapter
{
public TDestination Map<TSource, TDestination>(TSource source)
{
return Activator.CreateInstance<TDestination>()!;
}
}
β When to Use
When you want to isolate your application logic from infrastructure dependencies
When you want to mock mappings in unit/integration tests
When you're building a pluggable or framework-based system
π’ Maintained by
ArkaSoftware
π§ Email Us
π Web Site Visit
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 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. |
-
net9.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on ArkaSoftware.Extensions.ObjectMappers.Abstractions:
| Package | Downloads |
|---|---|
|
ArkaSoftware.Extensions.ObjectMappers.AutoMapper
Object Mapper Auto In Usage Asp.net Core |
|
|
Arks.Framework.Utilities.OutService
A multi-purpose library for .NET developers, including utilities for working with Persian dates, strings, and unique ID generation. |
GitHub repositories
This package is not used by any popular GitHub repositories.