ClearMapper.DependencyInjection
1.3.4
dotnet add package ClearMapper.DependencyInjection --version 1.3.4
NuGet\Install-Package ClearMapper.DependencyInjection -Version 1.3.4
<PackageReference Include="ClearMapper.DependencyInjection" Version="1.3.4" />
<PackageVersion Include="ClearMapper.DependencyInjection" Version="1.3.4" />
<PackageReference Include="ClearMapper.DependencyInjection" />
paket add ClearMapper.DependencyInjection --version 1.3.4
#r "nuget: ClearMapper.DependencyInjection, 1.3.4"
#:package ClearMapper.DependencyInjection@1.3.4
#addin nuget:?package=ClearMapper.DependencyInjection&version=1.3.4
#tool nuget:?package=ClearMapper.DependencyInjection&version=1.3.4
ClearMapper 😃
ClearMapper is a lightweight, high-performance object-to-object mapper for .NET projects. It simplifies mapping between objects with minimal configuration and supports complex scenarios.
features:
- map from all of IEnumerable typr to another IEnumerable type with better performance and spped.
- map from IQueryable type to another IQueryable type with out roudtrip for database.
- map from any class to another class.
- and ...
how to use?
step 1: create two classes with below names. FirstClass SecondClass
public class FirstClass
{
public int FistClassID { get; set; }
public string Title { get; set; }
}
public class SecondClass
{
public int SecondClassID { get; set; }
public string FullName { get; set; }
}
step 2: install 'ClearMapper' package from NUGET.
step 3: create Profile class For configure of map for ClearMapper
public class Profile : ClearMapperProfile
{
public Profile(ClearMapperOption option) : base(option)
{
option.AddConfiguration<FirstClass, SecondClass>(i =>
new SecondClass()
{
SecondClassID = i.FistClassID,
FullName = i.Title,
});
}
}
step 4: create insatance of CLearMapper of inject it from IOC. and call Map for map my class to another class.
var mapper = new ClearMapper();
//define some objection for mapping process
var firstClass = new FirstClass()
{
FistClassID = 10
};
var listOfFistClass = new List<FirstClass>();
listOfFistClass.Add(firstClass);
//map list of FirstClass to list of SecondClass
var listOfSecondClass = mapper.Map<FirstClass, SecondClass>(listOfFistClass);
//map list of FirstClass to list of ThirdClass
var listOfThirdClass = mapper.Map<FirstClass, ThirdClass>(listOfFistClass);
//Map single of FirstClass to another single of SecondClass
var secondClass = mapper.Map<FirstClass, SecondClass>(firstClass);
how to inject in program.cs:
install 'ClearMapper.DependencyInjection' from NUGET. and write below code in program.cs
builder.Services.UseClearMapper()
and inject IMapper in your classes like this:
public class MyClass
{
public MyClass(IMapper mapper)
{
}
}
don't forget to share ClearMapper with your friends. thanks 😃
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. 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. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- ClearMapper (>= 1.3.4)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.