{"id":23387130,"url":"https://github.com/manusoft/mappy","last_synced_at":"2026-03-04T04:01:12.465Z","repository":{"id":268446376,"uuid":"904386783","full_name":"manusoft/Mappy","owner":"manusoft","description":"Mappy is a lightweight object mapping utility for C# applications.","archived":false,"fork":false,"pushed_at":"2025-11-24T17:30:59.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-27T12:41:37.044Z","etag":null,"topics":["dotnet-6","dotnet-8","dotnet-9","object-mapper","package"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/Mappy.dotNet","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/manusoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2024-12-16T19:39:13.000Z","updated_at":"2025-11-24T17:30:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"6a450eec-a9ae-40a3-96f6-2b5fc69a7b4c","html_url":"https://github.com/manusoft/Mappy","commit_stats":null,"previous_names":["manusoft/mappy"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/manusoft/Mappy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manusoft%2FMappy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manusoft%2FMappy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manusoft%2FMappy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manusoft%2FMappy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manusoft","download_url":"https://codeload.github.com/manusoft/Mappy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manusoft%2FMappy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30071670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T03:25:38.285Z","status":"ssl_error","status_checked_at":"2026-03-04T03:25:05.086Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["dotnet-6","dotnet-8","dotnet-9","object-mapper","package"],"created_at":"2024-12-22T01:14:41.347Z","updated_at":"2026-03-04T04:01:12.459Z","avatar_url":"https://github.com/manusoft.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Static Badge](https://img.shields.io/badge/Mappy-red) ![NuGet Version](https://img.shields.io/nuget/v/Mappy.dotNet) ![NuGet Downloads](https://img.shields.io/nuget/dt/Mappy.dotNet) ![.NET](https://img.shields.io/badge/.NET-8%20%7C%209-blueviolet)\n\n# 🍁Mappy - Object Mapping\n![8253945](https://github.com/user-attachments/assets/1c6efc2b-c138-4e57-a13e-4657744b556e)\n\n## Introduction\n**Mappy** is a lightweight object mapping utility for C# applications. It allows you to easily map objects between models and DTOs, handle nested objects, and map collections. This utility supports both synchronous and asynchronous mapping operations, with options for custom transformations.\n\n---\n\n## Features\n- **Simple Object Mapping**: Map properties between objects with identical names and types.\n- **Nested Object Mapping**: Automatically maps nested properties.\n- **Collection Mapping**: Handles collections of objects and maps them to the destination collection type.\n- **Custom Mapping**: Supports custom transformations using lambda expressions.\n- **Asynchronous Mapping**: Enables async operations for custom transformations.\n- **Support mapping private properties**.\n- **Null Safety**: Handles null values gracefully. :🆕\n- **Type Safety**: Ensures type safety by matching properties based on type rather than just name, preventing errors when types differ. :🆕\n- **Circular Reference Handling**: Implements circular reference handling function. 🆕\n- **Performance**: Provides good performance for typical scenarios. 🆕\n  \n---\n\n## Installation\nTo install Mappy, you can use NuGet:\n\n``` shell\ndotnet add package Mappy.dotNet --version 2.1.0\n```\n\n## Usage\n\n### 1. Simple Mapping\n```csharp\nvar source = new Source { Id = 1, Name = \"Test\" };\nvar destination = source.Map\u003cDestination\u003e();\nConsole.WriteLine($\"Simple Mapping - Source Name: {source.Name}, Destination Name: {destination.Name}\");\n```\n``` shell\nSimple Mapping - Source Name: Test, Destination Name: Test\n```\n\n### 2. Nested Object Mapping\n```csharp\nvar nestedSource = new NestedSource { Id = 1, Inner = new InnerSource { Detail = \"DetailInfo\" } };\nvar nestedDestination = nestedSource.Map\u003cNestedDestination\u003e();\nConsole.WriteLine($\"Nested Mapping - Source Detail: {nestedSource.Inner.Detail}, Destination Detail: {nestedDestination.Inner.Detail}\");\n```\n``` shell\nNested Mapping - Source Detail: DetailInfo, Destination Detail: DetailInfo\n```\n\n### 3. Collection Mapping\n```csharp\nvar sourceList = new List\u003cSource\u003e\n            {\n                new Source { Id = 1, Name = \"Item1\" },\n                new Source { Id = 2, Name = \"Item2\" }\n            };\nvar destinationList = sourceList.MapCollection\u003cDestination\u003e();\nConsole.WriteLine(\"Collection Mapping:\");\nforeach (var item in destinationList)\n{\n    Console.WriteLine($\"Source Name: {item.Name}\");\n}\n```\n``` shell\nCollection Mapping:\nSource Name: Item1\nSource Name: Item2\n```\n\n### 4. Async Mapping\n```csharp\nvar asyncSource = new Source { Id = 2, Name = \"AsyncTest\" };\nvar asyncDestination = await asyncSource.MapAsync\u003cDestination\u003e(async d =\u003e\n{\n    d.Name = await Task.FromResult(asyncSource.Name + \" - Async\");\n});\nConsole.WriteLine($\"Async Mapping - Source Name: {asyncSource.Name}, Destination Name: {asyncDestination.Name}\");\n```\n``` shell\nAsync Mapping - Source Name: AsyncTest, Destination Name: AsyncTest - Async\n```\n\n### 5. Custom Mapping\n```csharp\nvar source4 = new Source { Id = 1, Name = \"Test\" };\n\nvar customDestination = source.Map\u003cDestination\u003e(d =\u003e\n{\n    // Custom logic: Add a suffix to the Name property\n    d.Name = $\"{source.Name} - Custom Mapped\";\n});\n\nConsole.WriteLine($\"Custom Mapping - Source Name: {source.Name}, Destination Name: {customDestination.Name}\");\n```\n``` shell\nCustom Mapping - Source Name: Test, Destination Name: Test - Custom Mapped\n```\n\n\n### 6. Asynchronous Custom Mapping\n```csharp\nvar asyncSource4 = new Source { Id = 2, Name = \"AsyncTest\" };\n\nvar asyncCustomDestination = await asyncSource.MapAsync\u003cDestination\u003e(async d =\u003e\n{\n    // Custom async logic: Simulate an async transformation\n    d.Name = await Task.FromResult(source.Name + \" - Async Custom\");\n});\n\nConsole.WriteLine($\"Async Custom Mapping - Source Name: {asyncSource.Name}, Destination Name: {asyncCustomDestination.Name}\");\n```\n``` shell\nAsync Custom Mapping - Source Name: AsyncTest, Destination Name: Test - Async Custom\n```\n\n### 7. Type Safety :🆕\n```csharp\ntry\n{\n    var source = new Source { Id = 1, Name = \"Test\" };\n    var invalidDestination = source.Map\u003cInvalidDestination\u003e(); // Will throw InvalidOperationException due to type mismatch\n}\ncatch (InvalidOperationException ex)\n{\n    Console.WriteLine($\"Type Safety Error: {ex.Message}\");\n}\n```\n\n### 8. Performance Test (Simple \u0026 Async) :🆕\n```csharp\nint count = 10000;\nvar largeSourceList = Enumerable.Range(1, count).Select(i =\u003e new Source { Id = i, Name = \"Test\" }).ToList();\n\n// Measuring Simple Mapping Performance\nvar stopwatch = System.Diagnostics.Stopwatch.StartNew();\nvar largeDestinationList = largeSourceList.MapCollection\u003cDestination\u003e();\nstopwatch.Stop();\nConsole.WriteLine($\"Simple Collection Mapping Performance: {stopwatch.ElapsedMilliseconds} ms for {count} items\");\n\n// Measuring Asynchronous Mapping Performance\nstopwatch.Restart();\nvar largeAsyncDestinationList = await largeSourceList.MapCollectionAsync\u003cDestination\u003e(async d =\u003e\n{\n    d.Name = await Task.FromResult(\"Async - \" + d.Name);\n});\nstopwatch.Stop();\nConsole.WriteLine($\"Asynchronous Collection Mapping Performance: {stopwatch.ElapsedMilliseconds} ms for {count} items\");\n```\n``` shell\nSimple Collection Mapping Performance: 18 ms for 10000 items\nAsynchronous Collection Mapping Performance: 29 ms for 10000 items\n```\n---\n\n## Performance Considerations\nWhile Mappy is effective for typical scenarios, it may not be optimized for very large datasets or scenarios with high-frequency mapping needs. The performance of the library could be impacted by reflection-based operations, especially for large collections and complex nested mappings.\n\n## Contributing\nContributions to Mappy are welcome! If you find any issues or have suggestions for improvements, feel free to create a pull request or report an issue.\n\n## License\nThis project is open source and can be freely modified and distributed.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanusoft%2Fmappy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanusoft%2Fmappy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanusoft%2Fmappy/lists"}