{"id":13578211,"url":"https://github.com/cezarypiatek/MappingGenerator","last_synced_at":"2025-04-05T16:32:03.509Z","repository":{"id":47441625,"uuid":"121686349","full_name":"cezarypiatek/MappingGenerator","owner":"cezarypiatek","description":":arrows_counterclockwise: \"AutoMapper\" like, Roslyn based, code fix provider that allows to generate mapping code in design time.","archived":true,"fork":false,"pushed_at":"2022-01-16T08:27:46.000Z","size":1886,"stargazers_count":1030,"open_issues_count":10,"forks_count":120,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-01-17T20:37:47.228Z","etag":null,"topics":["automapper","c-sharp","code-generation","codegenerator","dotnet","mapper","mapping","roslyn","visual-studio","vsix"],"latest_commit_sha":null,"homepage":"https://marketplace.visualstudio.com/items?itemName=54748ff9-45fc-43c2-8ec5-cf7912bc3b84.mappinggenerator","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/cezarypiatek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-15T21:43:02.000Z","updated_at":"2024-12-28T08:41:54.000Z","dependencies_parsed_at":"2022-08-23T15:22:04.394Z","dependency_job_id":null,"html_url":"https://github.com/cezarypiatek/MappingGenerator","commit_stats":null,"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cezarypiatek%2FMappingGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cezarypiatek%2FMappingGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cezarypiatek%2FMappingGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cezarypiatek%2FMappingGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cezarypiatek","download_url":"https://codeload.github.com/cezarypiatek/MappingGenerator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247366446,"owners_count":20927511,"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":["automapper","c-sharp","code-generation","codegenerator","dotnet","mapper","mapping","roslyn","visual-studio","vsix"],"created_at":"2024-08-01T15:01:28.465Z","updated_at":"2025-04-05T16:32:02.430Z","avatar_url":"https://github.com/cezarypiatek.png","language":"C#","readme":"## WHY THIS PROJECT IS ARCHIVED - EXPLANATION\n------------------------------\nMappingGenerator is discontinued in the form of FOSS. I spent the last three months (March 2021 - June 2021) working hard on improving MappingGenerator. I solved many issues and added a bunch of new cool features. I also made a general refactoring which restored the project maintainability. All of that cost me a lot of my private time and I did it all by myself, so I decided to convert MappingGenerator into a commercial product. A perpetual license for a new version of MappingGenerator can be obtained via the official product website https://www.mappinggenerator.net/\n\nI would like to thank all of you who contributed to this product by reporting issues, testing, authoring PRs, or buying me coffee. **PR authors (except the Only README Updaters) and Coffee Buyers will be awarded with a special license for MappingGenerator for free -  I will send them an email with details in a few days.**\n\n🔥 Important Links: \n\n- Product page https://www.mappinggenerator.net/\n- Download page for VS2017 and VS2019 https://marketplace.visualstudio.com/items?itemName=54748ff9-45fc-43c2-8ec5-cf7912bc3b84.mappinggenerator\n- Download page for VS2022 https://marketplace.visualstudio.com/items?itemName=54748ff9-45fc-43c2-8ec5-cf7912bc3b84.MappingGenerator2022\n- Current release notes https://github.com/cezarypiatek/MappingGeneratorReleases/releases\n- New Issue Tracker https://github.com/cezarypiatek/MappingGeneratorIssueTracker\n\n------------------------------\n\n# Mapping Generator [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=\u0026quot;AutoMapper\u0026quot;%20ike,%20Roslyn%20based,%20code%20fix%20provider%20that%20allows%20to%20generate%20mapping%20code%20in%20design%20time.\u0026related=@cezary_piatek\u0026url=https://github.com/cezarypiatek/MappingGenerator)  \n\n\n\"AutoMapper\" like, Roslyn based, code fix provider that allows to generate mapping code in design time. Read more [Mapping Generator – Design Time Alternative to AutoMapper](https://guidnew.com/en/blog/mapping-generator-design-time-alternative-to-automapper/)\n\nYou can download it as Visual Studio Extension from [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=54748ff9-45fc-43c2-8ec5-cf7912bc3b84.mappinggenerator).\n\n## Motivation\n[The reasons behind why I don't use AutoMapper](https://cezarypiatek.github.io/post/why-i-dont-use-automapper/)\n\n\n### Contributing\nBefore you start any contributing work, please read the [contribution guideline](/docs/CONTRIBUTING.md)\n\n### Supported IDE\n\n#### VisualStudio.\nInstall as VSIX from [Market place](https://marketplace.visualstudio.com/items?itemName=54748ff9-45fc-43c2-8ec5-cf7912bc3b84.mappinggenerator) or as a [NuGet package](https://www.nuget.org/packages/MappingGenerator/). Verify your [Roslyn integration option in case you are using R#](#using-along-with-resharper).\n\n#### JetBrains Rider\nInstall as a [NuGet package](https://www.nuget.org/packages/MappingGenerator/)\n\n#### VSCode\nInstall as a [NuGet package](https://www.nuget.org/packages/MappingGenerator/) or use [this instruction](https://www.strathweb.com/2017/05/using-roslyn-refactorings-with-omnisharp-and-visual-studio-code/) to install from [VSIX](https://marketplace.visualstudio.com/items?itemName=54748ff9-45fc-43c2-8ec5-cf7912bc3b84.mappinggenerator)\n\n### Using along with Resharper\n\nIf you are not able to open Roslyn refactoring menu (`ctr + .`) please verify your Resharper settings related to `Visual Studio Integration` or `Visual Studio code analysis` (depends on the R# version). For more information please check [#50](https://github.com/cezarypiatek/MappingGenerator/issues/50)\n\n![resharper settings](doc/resharper_settings.jpg)\n\n## Main features\n\n### Generate mapping method body\n\n#### Pure mapping method\nNon-void method that takes single parameter\n\n```csharp\npublic UserDTO Map(UserEntity entity)\n{\n    \n}\n```\n\n![Generating pure mapping method implementation](doc/pure_mapping_method_newone.gif)\n\n\n#### Updating method\nVoid method that takes two parameters\n```csharp\npublic void Update(UserDTO source, UserEntity target)\n{\n    \n}\n```\n![Generating update method implementation](doc/update_method.gif)\n\n\n#### Mapping Constructor\nConstructor method that takes single complex parameter\n\n```csharp\npublic UserDTO(UserEntity user)\n{\n    \n}\n```\n![Generating mapping constructor implementation](doc/mapping_constructor.gif)\n\nConstructor method that takes more than one parameter\n\n```csharp\npublic UserDTO(string firstName, string lastName, int age, int cash)\n{\n}\n```\n\n![Generating multi-parameter constructor](/doc/multiparameterconstructor.gif)\n\n\n\n#### Updating member method\nVoid member method that takes single parameter\n```csharp\npublic void UpdateWith(UserEntity en)\n{\n    \n}\n```\n\n![Generating update member method imeplementation](doc/update_member_method.gif)\n\nVoid member method with more than one parameter\n```csharp\npublic void Update(string firstName, string lastName, int age)\n{\n}\n```\n![](/doc/multiparameterupdate.gif)\n\n\n### Generate inline code for fixing Compiler Errors: \n[CS0029](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0029) Cannot implicitly convert type 'type' to 'type'\n\n![cs0029](/doc/cs0029.jpg)\n\n[CS0266](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0266) Cannot implicitly convert type 'type1' to 'type2'. An explicit conversion exists (are you missing a cast?)\n\n![cs0266](/doc/cs0266.jpg)\n\nCS7036 There is no argument given that corresponds to the required formal parameter \n\n![CS7036](/doc/splatting.gif)\n\n## Other mappings\n\n- Complete empty initialization block\n![Generate initialization bloc](doc/emptyInitialization.gif)\n\n- Complete empty initialization block in lambda expression `Expression\u003cFunc\u003cT,T2\u003e\u003e = (T) =\u003e new T2{}`\n![initialization block in lambda expression](https://user-images.githubusercontent.com/7759991/41869113-4704c6f0-78b8-11e8-8c3c-47a6b5bf308c.gif)\n\n- Provide local accessible variables as parameters for method and constructor invocation\n![locals as parameters](doc/localsforconstructor.gif)\n\n- Create missing mapping lambda  \n![mapping lambda](doc/mapping_lambda.gif)\n\n-  Generate ICloneable interface implementation\n ![generate clone method](https://user-images.githubusercontent.com/7759991/44867726-f45c0080-ac88-11e8-87e9-feed8242af79.gif)\n\n## Object scaffolding\n\n![sample scaffolding](/doc/object_scaffolding.gif)\n\n## Mapping rules\n- Mapping Property-To-Property\n  ```csharp\n  target.FirstName = source.FirstName;\n  target.LastName = source.LastName;\n  ```\n- Mapping Method Call-To-Property\n  ```csharp\n  target.Total = source.GetTotal()\n  ```\n- Flattening with sub-property\n  ```csharp\n  target.UnitId = source.Unit.Id\n  ```\n- Mapping complex property\n  ```csharp\n   target.MainAddress = new AddressDTO(){\n  \tBuildingNo = source.MainAddress.BuildingNo,\n  \tCity = source.MainAddress.City,\n  \tFlatNo = source.MainAddress.FlatNo,\n  \tStreet = source.MainAddress.Street,\n  \tZipCode = source.MainAddress.ZipCode\n  };\n  ```\n- Mapping collections\n  ```csharp\n  target.Addresses = source.Addresses.Select(sourceAddresse =\u003e new AddressDTO(){\n    BuildingNo = sourceAddresse.BuildingNo,\n    City = sourceAddresse.City,\n    FlatNo = sourceAddresse.FlatNo,\n    Street = sourceAddresse.Street,\n    ZipCode = sourceAddresse.ZipCode\n  }).ToList().AsReadOnly();\n  ```\n- Unwrapping wrappers \n  ```csharp\n  customerEntity.Kind = cutomerDTO.Kind.Selected;\n  ```\n  \n  ```csharp\n    public enum CustomerKind\n    {\n        Regular,\n        Premium\n    }\n\n    public class Dropdown\u003cT\u003e\n    {\n        public List\u003cT\u003e AllOptions { get; set; }\n\n        public T Selected { get; set; }\n    }\n\n    public class CustomerDTO\n    {\n        public string Name { get; set; }\n        public Dropdown\u003cCustomerKind\u003e Kind { get; set; }\n    }\n\n    public class UserEntity\n    {\n        public string Name { get; set; }\n        public CustomerKind Kind { get; set; }\n    }\n  ```\n- Using existing direct mapping constructor\n  ```csharp\n  target.MainAddress = new AddressDTO(source.MainAddress);\n  ```\n\n- using existing multi-parameter constuctor\n  ```csharp\n  this.User =  new UserDTO(firstName: entity.FirstName, lastName: entity.LastName, age: entity.Age);\n  ```\n\n","funding_links":[],"categories":["dotnet","C#","C# #","C\\#","Open Source Analyzers, Code Fixes, and Refactorings","Popular Analyzers"],"sub_categories":["Miscellaneous"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcezarypiatek%2FMappingGenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcezarypiatek%2FMappingGenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcezarypiatek%2FMappingGenerator/lists"}