NetMapper 1.1.3
dotnet add package NetMapper --version 1.1.3
NuGet\Install-Package NetMapper -Version 1.1.3
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="NetMapper" Version="1.1.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NetMapper" Version="1.1.3" />
<PackageReference Include="NetMapper" />
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 NetMapper --version 1.1.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NetMapper, 1.1.3"
#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 NetMapper@1.1.3
#: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=NetMapper&version=1.1.3
#tool nuget:?package=NetMapper&version=1.1.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
NetMapper
NetMapper is a lightweight and fast object mapping library for .NET, without using reflection at runtime. It is ideal for applications that require high performance and low coupling.
✅ Features
- Mapping between different objects (DTO ↔ Entity)
- Date formatting support with the
[MapWithFormat]attribute - Ignore properties with
[IgnoreMap] - Mapping with different names using
[MapTo("DestinationName")] - Allows customization with
delegateduring mapping
📦 Installation
dotnet add package NetMapper
## 🛠️ Object Configurations
public class Product
{
public string ProductName { get; set; }
[MapTo("ManufactureDate")]
public DateTime Manufacture { get; set; }
public decimal Price { get; set; }
public string Status { get; set; }
public List<OrderItem> Items { get; set; }
}
public class ProductDTO
{
public string ProductName { get; set; }
[MapWithFormat("dd/MM/yyyy")]
[MapWithFormat("dd/MM/yyyy HH:mm")]
[MapWithFormat("dd/MM/yyyy HH:mm:ss")]
public string ManufactureDate { get; set; }
[IgnoreMap]
public decimal Price { get; set; }
public string Status { get; set; }
public List<OrderItem> Items { get; set; }
}
## 🔁 Example 1 – Simple Mapping
var product = new Product
{
ProductName = "Keyboard",
Manufacture = DateTime.Now,
Price = 100.00m,
Status = "S"
};
var dtoProduct = product.MapTo<Product, ProductDTO>(dto =>
{
dto.ProductName = dto.ProductName.ToUpper();
dto.Status = product.Status switch
{
"S" => "Active",
"N" => "Inactive"
};
});
## 📄 Example 2 – Simple List Mapping
var products = new List<Product>
{
new Product { ProductName = "Laptop", Price = 3500.99m, Manufacture = DateTime.Now, Status = "Active" },
new Product { ProductName = "Mouse", Price = 150.50m, Manufacture = DateTime.Now, Status = "Active" }
};
var productsDTO = products.MapToList<Product, ProductDTO>();
## 📦 Example 3 – List Mapping with Composed Objects
var products = new List<Product>
{
new Product
{
ProductName = "Laptop",
Price = 3500.99m,
Manufacture = DateTime.Now,
Status = "Active",
Items = new List<OrderItem> { new OrderItem { ProductCode = 12323 } }
},
new Product
{
ProductName = "Monitor",
Price = 1200.75m,
Manufacture = DateTime.Now,
Status = "Active",
Items = new List<OrderItem> { new OrderItem { ProductCode = 23412 } }
}
};
var productsDTO = products.MapToList<Product, ProductDTO>();
## 🧩 Example 4 – Mapping a Composed Object
var product = new Product
{
ProductName = "Laptop",
Price = 3500.99m,
Manufacture = DateTime.Now,
Status = "Active",
Items = new List<OrderItem> { new OrderItem { ProductCode = 12323 } }
};
var dto = product.MapTo<Product, ProductDTO>();
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.3 | 112 | 4/12/2025 |