{"id":15108777,"url":"https://github.com/mapstermapper/mapster","last_synced_at":"2026-04-20T11:05:25.819Z","repository":{"id":17540102,"uuid":"20342794","full_name":"MapsterMapper/Mapster","owner":"MapsterMapper","description":"A fast, fun and stimulating object to object Mapper","archived":false,"fork":false,"pushed_at":"2024-06-17T20:46:35.000Z","size":1527,"stargazers_count":4403,"open_issues_count":207,"forks_count":333,"subscribers_count":77,"default_branch":"master","last_synced_at":"2024-12-22T09:47:49.440Z","etag":null,"topics":["c-sharp","codegenerator","fast","mapper","mapping"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MapsterMapper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-05-30T21:19:14.000Z","updated_at":"2024-12-21T19:35:48.000Z","dependencies_parsed_at":"2023-09-22T04:21:21.406Z","dependency_job_id":"ee4638f5-c907-4dad-94ec-6bb2bfb30c23","html_url":"https://github.com/MapsterMapper/Mapster","commit_stats":{"total_commits":562,"total_committers":50,"mean_commits":11.24,"dds":0.5480427046263345,"last_synced_commit":"04ac871b55828c3909b6cee4764e6fab40db3983"},"previous_names":["eswann/mapster"],"tags_count":52,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MapsterMapper%2FMapster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MapsterMapper%2FMapster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MapsterMapper%2FMapster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MapsterMapper%2FMapster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MapsterMapper","download_url":"https://codeload.github.com/MapsterMapper/Mapster/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250382037,"owners_count":21421247,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-sharp","codegenerator","fast","mapper","mapping"],"created_at":"2024-09-25T22:40:24.860Z","updated_at":"2026-04-20T11:05:25.810Z","avatar_url":"https://github.com/MapsterMapper.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Mapster Icon](https://raw.githubusercontent.com/MapsterMapper/Mapster/master/docs/images/mapster-logo.svg)\n\n# Mapster - The Mapper of Your Domain\n\nWriting mapping methods is a machine job. Do not waste your time, let Mapster do it.\n\n## NuGet Sources\n\n### NuGet Packages\n\n| Package | Stable | Pre-release |\n|---------|--------|-------------|\n| **Mapster** | [![Mapster](https://img.shields.io/nuget/v/Mapster.svg?label=Mapster\u0026color=informational)](https://www.nuget.org/packages/Mapster/latest) | [![Mapster](https://img.shields.io/nuget/vpre/Mapster.svg?label=Mapster\u0026color=orange)](https://www.nuget.org/packages/Mapster) |\n| **Mapster.Core** | [![Mapster.Core](https://img.shields.io/nuget/v/Mapster.Core.svg?label=Mapster.Core\u0026color=informational)](https://www.nuget.org/packages/Mapster.Core/latest) | [![Mapster.Core](https://img.shields.io/nuget/vpre/Mapster.Core.svg?label=Mapster.Core\u0026color=orange)](https://www.nuget.org/packages/Mapster.Core) |\n| **Mapster.DependencyInjection** | [![Mapster.DependencyInjection](https://img.shields.io/nuget/v/Mapster.DependencyInjection.svg?label=Mapster.DependencyInjection\u0026color=informational)](https://www.nuget.org/packages/Mapster.DependencyInjection/latest) | [![Mapster.DependencyInjection](https://img.shields.io/nuget/vpre/Mapster.DependencyInjection.svg?label=Mapster.DependencyInjection\u0026color=orange)](https://www.nuget.org/packages/Mapster.DependencyInjection) |\n| **Mapster.EFCore** | [![Mapster.EFCore](https://img.shields.io/nuget/v/Mapster.EFCore.svg?label=Mapster.EFCore\u0026color=informational)](https://www.nuget.org/packages/Mapster.EFCore/latest) | [![Mapster.EFCore](https://img.shields.io/nuget/vpre/Mapster.EFCore.svg?label=Mapster.EFCore\u0026color=orange)](https://www.nuget.org/packages/Mapster.EFCore) |\n| **Mapster.EF6** | [![Mapster.EF6](https://img.shields.io/nuget/v/Mapster.EF6.svg?label=Mapster.EF6\u0026color=informational)](https://www.nuget.org/packages/Mapster.EF6/latest) | [![Mapster.EF6](https://img.shields.io/nuget/vpre/Mapster.EF6.svg?label=Mapster.EF6\u0026color=orange)](https://www.nuget.org/packages/Mapster.EF6) |\n| **Mapster.JsonNet** | [![Mapster.JsonNet](https://img.shields.io/nuget/v/Mapster.JsonNet.svg?label=Mapster.JsonNet\u0026color=informational)](https://www.nuget.org/packages/Mapster.JsonNet/latest) | [![Mapster.JsonNet](https://img.shields.io/nuget/vpre/Mapster.JsonNet.svg?label=Mapster.JsonNet\u0026color=orange)](https://www.nuget.org/packages/Mapster.JsonNet) |\n| **Mapster.Immutable** | [![Mapster.Immutable](https://img.shields.io/nuget/v/Mapster.Immutable.svg?label=Mapster.Immutable\u0026color=informational)](https://www.nuget.org/packages/Mapster.Immutable/latest) | [![Mapster.Immutable](https://img.shields.io/nuget/vpre/Mapster.Immutable.svg?label=Mapster.Immutable\u0026color=orange)](https://www.nuget.org/packages/Mapster.Immutable) |\n| **Mapster.Diagnostics** | [![Mapster.Diagnostics](https://img.shields.io/nuget/v/Mapster.Diagnostics.svg?label=Mapster.Diagnostics\u0026color=informational)](https://www.nuget.org/packages/Mapster.Diagnostics/latest) |  |\n| **ExpressionDebugger** | [![ExpressionDebugger](https://img.shields.io/nuget/v/ExpressionDebugger.svg?label=ExpressionDebugger\u0026color=informational)](https://www.nuget.org/packages/ExpressionDebugger/latest) |  |\n\n### DotNet Tools\n\n| Tool | Stable | Pre-release |\n|------|--------|-------------|\n| **Mapster.Tool** | [![Mapster.Tool](https://img.shields.io/nuget/v/Mapster.Tool.svg?label=Mapster.Tool\u0026color=informational)](https://www.nuget.org/packages/Mapster.Tool/latest) | [![Mapster.Tool](https://img.shields.io/nuget/vpre/Mapster.Tool.svg?label=Mapster.Tool\u0026color=orange)](https://www.nuget.org/packages/Mapster.Tool) |\n\n\n## Installation\n\nInstall Mapster with the NuGet CLI:\n\n```Powershell\nInstall-Package Mapster\n```\n\nOr use the .NET core CLI to install Mapster:\n\n```bash\ndotnet add package Mapster --project \u003cPROJECT_NAME\u003e\n```\n\n## Basic usage\n\n### Mapping to a new object\n\nMapster creates the destination object and maps values to it.\n\n```csharp\nvar destObject = sourceObject.Adapt\u003cDestination\u003e();\n```\n\n### Mapping to an existing object\n\nYou create the object, Mapster maps to the object.\n\n```csharp\nsourceObject.Adapt(destObject);\n```\n\n### Use Mapster with Dependency Injection\n\nYou can get your `IMapper` instance via dependency injection, so you do not have to change code, when migrating to mapster from automapper!\n\n**Just add Mapster to service collection:**\n\n```csharp\nservices.AddMapster();\n```\n\n**And use it with DI in your Project:**\n\n```csharp\npublic class Test\n{\n    public Test(IMapper mapper)\n    {\n        var sourceObject = mapper.Adapt\u003cDestination\u003e();\n    }\n}\n```\n\n### Queryable Extensions\n\nMapster also provides extensions to map queryables.\n\n```csharp\nusing (MyDbContext context = new MyDbContext())\n{\n    // Build a Select Expression from DTO\n    var destinations = context.Sources.ProjectToType\u003cDestination\u003e().ToList();\n\n    // Versus creating by hand:\n    var destinations = context.Sources.Select(c =\u003e new Destination {\n        Id = c.Id,\n        Name = c.Name,\n        Surname = c.Surname,\n        ....\n    })\n    .ToList();\n}\n```\n\n### Generating models \u0026 mappers\n\nNo need to write your own DTO classes. Mapster provides [Mapster.Tool](https://mapstermapper.github.io/Mapster/articles/tools/mapster-tool/Mapster-Tool-Overview.html) to help you generating models. And if you would like to have explicit mapping, Mapster also generates mapper class for you.\n\n```csharp\n[AdaptTo(\"[name]Dto\"), GenerateMapper]\npublic class Student {\n    ...\n}\n```\n\nThen Mapster will generate for you:\n\n```csharp\npublic class StudentDto {\n    ...\n}\npublic static class StudentMapper {\n    public static StudentDto AdaptToDto(this Student poco) { ... }\n    public static StudentDto AdaptTo(this Student poco, StudentDto dto) { ... }\n    public static Expression\u003cFunc\u003cStudent, StudentDto\u003e\u003e ProjectToDto =\u003e ...\n}\n```\n\n## What's new\n\n- [Fluent API for code generation](https://mapstermapper.github.io/Mapster/articles/tools/mapster-tool/Fluent-API-Code-generation.html)\n- [Automatically generate mapping code on build](https://mapstermapper.github.io/Mapster/articles/tools/mapster-tool/Mapster-Tool-Overview.html)\n- [Define setting to nested mapping](https://mapstermapper.github.io/Mapster/articles/configuration/Config-for-nested-mapping.html)\n- [`ISet`, `IDictionary`, `IReadOnlyDictionary` support](https://mapstermapper.github.io/Mapster/articles/mapping/Data-types.html#collections)\n- [`EmptyCollectionIfNull`, `CreateNewIfNull` DestinationTransform](https://mapstermapper.github.io/Mapster/articles/settings/Setting-values.html#transform-value)\n- [Several fixes](https://github.com/MapsterMapper/Mapster/releases/)\n- New plugins\n  - [Immutable collection support](https://mapstermapper.github.io/Mapster/articles/packages/Immutable.html)\n\n## Why Mapster?\n\n### Performance \u0026 Memory efficient\n\nMapster was designed to be efficient on both speed and memory. You could gain a 4x performance improvement whilst using only 1/3 of memory.\nAnd you could gain up to 12x faster performance with:\n\n- [Roslyn Compiler](https://mapstermapper.github.io/Mapster/articles/packages/ExpressionDebugging.html)\n- [FEC](https://mapstermapper.github.io/Mapster/articles/packages/FastExpressionCompiler.html)\n- Code generation\n\n|                    Method |      Mean |    StdDev |     Error |      Gen 0 | Gen 1 | Gen 2 | Allocated |\n|-------------------------- |----------:|----------:|----------:|-----------:|------:|------:|----------:|\n|           'Mapster 6.0.0' | 108.59 ms |  1.198 ms |  1.811 ms | 31000.0000 |     - |     - | 124.36 MB |\n|  'Mapster 6.0.0 (Roslyn)' |  38.45 ms |  0.494 ms |  0.830 ms | 31142.8571 |     - |     - | 124.36 MB |\n|     'Mapster 6.0.0 (FEC)' |  37.03 ms |  0.281 ms |  0.472 ms | 29642.8571 |     - |     - | 118.26 MB |\n| 'Mapster 6.0.0 (Codegen)' |  34.16 ms |  0.209 ms |  0.316 ms | 31133.3333 |     - |     - | 124.36 MB |\n|     'ExpressMapper 1.9.1' | 205.78 ms |  5.357 ms |  8.098 ms | 59000.0000 |     - |     - | 236.51 MB |\n|       'AutoMapper 10.0.0' | 420.97 ms | 23.266 ms | 35.174 ms | 87000.0000 |     - |     - | 350.95 MB |\n\n### Step into debugging\n\n[Step-into debugging](https://mapstermapper.github.io/docs/packages/Diagnostics.html) lets you debug your mapping and inspect values just like your code.\n\n![inspect-generated-source-code-while-debugging](https://cloud.githubusercontent.com/assets/5763993/26521773/180427b6-431b-11e7-9188-10c01fa5ba5c.png)\n\n### Code Generation\n\nCode generation allows you to\n\n- Validate mapping at compile time\n- Getting raw performance\n- Seeing your mapping code \u0026 debugging\n- Finding usage of your models' properties\n\nThere are currently two tools which you can choose based on your preferences.\n\n- [Mapster.Tool](https://mapstermapper.github.io/Mapster/articles/tools/mapster-tool/Mapster-Tool-Overview.html) _**NEW!**_\n- [TextTemplate](https://mapstermapper.github.io/Mapster/articles/tools/TextTemplate.html)\n\n## Change logs\n\nhttps://github.com/MapsterMapper/Mapster/releases\n\n## Usage Guides with Translations\n\n- [English](https://github.com/MapsterMapper/Mapster/wiki)\n- [中文文档](https://github.com/rivenfx/Mapster-docs) (sp thx to [@staneee](https://github.com/staneee))\n\n## Acknowledgements\n\n[JetBrains](https://www.jetbrains.com/?from=Mapster) kindly provides Mapster with a free open-source licence for their Resharper and Rider.\n\n- **Resharper** makes Visual Studio a much better IDE\n- **Rider** is fast \u0026 powerful cross platform .NET IDE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapstermapper%2Fmapster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapstermapper%2Fmapster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapstermapper%2Fmapster/lists"}