{"id":19991394,"url":"https://github.com/jitbit/PropMapper","last_synced_at":"2025-05-04T10:31:32.325Z","repository":{"id":52654151,"uuid":"175029822","full_name":"jitbit/PropMapper","owner":"jitbit","description":"Object mapper for .NET. Flat and basic, but FAST.","archived":false,"fork":false,"pushed_at":"2021-10-12T09:06:37.000Z","size":25,"stargazers_count":33,"open_issues_count":1,"forks_count":11,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-04T08:47:59.872Z","etag":null,"topics":["c-sharp","dotnet","mapper","object-mapper"],"latest_commit_sha":null,"homepage":"https://www.jitbit.com","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/jitbit.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}},"created_at":"2019-03-11T15:30:54.000Z","updated_at":"2023-08-30T15:04:47.000Z","dependencies_parsed_at":"2022-08-22T00:01:12.948Z","dependency_job_id":null,"html_url":"https://github.com/jitbit/PropMapper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jitbit%2FPropMapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jitbit%2FPropMapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jitbit%2FPropMapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jitbit%2FPropMapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jitbit","download_url":"https://codeload.github.com/jitbit/PropMapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252320305,"owners_count":21729101,"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","dotnet","mapper","object-mapper"],"created_at":"2024-11-13T04:51:44.098Z","updated_at":"2025-05-04T10:31:31.537Z","avatar_url":"https://github.com/jitbit.png","language":"C#","readme":"# PropMapper\n\nProperty mapper for .NET. Flat and basic, but **VERY FAST**.\n\nJust [one cs-file](PropMapper.cs), only 80 lines of code.\n\n## Installation\n\nDrop the cs-file into your project OR install via [Nuget](https://www.nuget.org/packages/PropMapper/)\n\n`Install-Package PropMapper`\n\n(this will will simply add the .cs file to your project, not a DLL-reference, so you're free of dependencies)\n\n## Usage\n\nJust one line of code:\n\n```cs\n//instantiating a new object\nDestType destObject = PropMapper\u003cSourceType, DestType\u003e.From(srcObj);\n```\n\nor\n\n```cs\n//using with existing objects\nPropMapper\u003cSourceType, DestType\u003e.CopyTo(srcObj, destObj);\n```\n\n## Benchmarks\n\nMapping a simple object with 50 properties, over 100k iterations.\n\nResults:\n\n| Mapper  | Results |\n| ------------- | ------------- |\n| Automapper   | 32490ms  |\n| Automapper with cached `config` object | 335ms  |\n| **PropMapper**   | **25ms**  |\n| Manual code  | 10ms  |\n\nPropMapper is more than 13 times faster. Here's the class we tested on:\n\n```cs\npublic class Tester\n{\n\tpublic string prop1 { get; set; }\n\tpublic string prop2 { get; set; }\n\tpublic string prop3 { get; set; }\n\tpublic int iprop1 { get; set; }\n\t//etc. 50 times\n}\n```\n\n## Under the hood\n\nWe use compiled Expression trees, created in the static constructor and cached in a var, which makes it really fast.\n\n## Use case: casting base class to derived class\n\n```cs\npublic class Person\n{\n\tpublic string FirstName { get; set; }\n\tpublic string LastName { get; set; }\n}\npublic class Employee : Person\n{\n\tpublic string Title { get; set; }\n\t\n\tpublic Employee(Person person)\n\t{\n\t\tPropMapper\u003cPerson, Employee\u003e.CopyTo(person, this);\n\t}\n}\n```\n\n# What's next?\n\nCurrently it's just one C# file, with unit tests, a proper library and more benchmarks coming later. The tool is in heavy use in [other projects](https://www.jitbit.com/) of ours, so it's regularly unit-tested anyway.\n","funding_links":[],"categories":["C\\#"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjitbit%2FPropMapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjitbit%2FPropMapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjitbit%2FPropMapper/lists"}