{"id":16683189,"url":"https://github.com/replaysmike/anymapper","last_synced_at":"2026-03-06T10:30:56.196Z","repository":{"id":96630381,"uuid":"160996659","full_name":"replaysMike/AnyMapper","owner":"replaysMike","description":"A CSharp library mapping alternative to AutoMapper with built-in support for Entity Framework. The terse mapper!","archived":false,"fork":false,"pushed_at":"2021-03-07T02:06:29.000Z","size":134,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-14T17:04:37.339Z","etag":null,"topics":["automapper","automatic-mapping","entity-framework","mapper","no-registration","terse"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/replaysMike.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":"2018-12-09T02:22:52.000Z","updated_at":"2025-06-10T18:32:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"f53ba356-edb9-449d-8fc9-c775cb497941","html_url":"https://github.com/replaysMike/AnyMapper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/replaysMike/AnyMapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/replaysMike%2FAnyMapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/replaysMike%2FAnyMapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/replaysMike%2FAnyMapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/replaysMike%2FAnyMapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/replaysMike","download_url":"https://codeload.github.com/replaysMike/AnyMapper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/replaysMike%2FAnyMapper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261125619,"owners_count":23113275,"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","automatic-mapping","entity-framework","mapper","no-registration","terse"],"created_at":"2024-10-12T14:23:31.805Z","updated_at":"2026-03-06T10:30:56.121Z","avatar_url":"https://github.com/replaysMike.png","language":"C#","readme":"# AnyMapper\n[![nuget](https://img.shields.io/nuget/v/AnyMapper.svg)](https://www.nuget.org/packages/AnyMapper/)\n[![nuget](https://img.shields.io/nuget/dt/AnyMapper.svg)](https://www.nuget.org/packages/AnyMapper/)\n[![Build status](https://ci.appveyor.com/api/projects/status/gfwjabg1pta7em94?svg=true)](https://ci.appveyor.com/project/MichaelBrown/anymapper)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/8001bb10a20c4456a98ed4dde145350a)](https://app.codacy.com/app/replaysMike/AnyMapper?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=replaysMike/AnyMapper\u0026utm_campaign=Badge_Grade_Dashboard)\n\nA CSharp library mapping alternative to AutoMapper with built-in support for Entity Framework 6 and Entity Framework Core. The terse mapper!\n\n## Description\n\nAnyMapper was built as a standalone object mapper that runs on either .Net Framework or .Net Core. The API is backwards compatible with AutoMapper so switching between the two is nearly seamless.\n\n## Differences from AutoMapper\n\nAnyMapper will automatically map between objects of different types as long as they have the same names and the types are the same or are different but convertable automatically.\n\n## Examples\n\nSimple usage:\n```csharp\nusing AnyMapper;\nvar destObject = Mapper.Map\u003cSourceObject, DestObject\u003e(sourceObject);\n```\n\nThe above example will map the type `SourceObject` to type `DestObject`. Any fields and properties with the same name will be mapped, recursively. You can also map the same type to create a new copy of the data:\n\n```csharp\nvar sourceObjectCloned = Mapper.Map\u003cSourceObject, SourceObject\u003e(sourceObject);\n```\n\nFor all of the examples below we will use the following test classes:\n```csharp\n// *** classes used in all the examples ***\npublic class SourceObject\n{\n  public string Name { get; set; }\n  public int Id { get; set; }\n  public DateTime DateCreated { get; set; }\n  public ICollection\u003cSimpleObject\u003e Items { get; set; }\n}\n\npublic class DestObject\n{\n  public string Name { get; set; }\n  public int Id { get; set; }\n  public DateTime DateCreated { get; set; }\n  public string Description { get; set; }\n  public bool IsEnabled { get; set; }\n  public ICollection\u003cSimpleObject\u003e Items { get; set; }\n}\n\n// our custom mapping profile that indicates how one object maps to another\npublic class MyMappingProfile : Profile\n{\n  public MyMappingProfile()\n  {\n    CreateMap\u003cSourceObject, DestObject\u003e()\n      .ForMember(x =\u003e x.Id, x =\u003e x.Id)\n      .ForMember(x =\u003e x.Name, x =\u003e x.Name)\n      .ForMember(x =\u003e x.DateCreated, x =\u003e x.DateCreated)\n    ;\n  }\n}\n```\n\nMap one object to another:\n```csharp\n\n// configure our mapping profile\nvar profile = new MyMappingProfile();\nMapper.Configure(config =\u003e\n{\n  config.AddProfile(profile);\n});\n\n// map one object to another\nvar sourceObject = new SourceObject { Id = 1, Name = \"Source object\", DateCreated = new DateTime(2018, 1, 1) };\nvar destObject = Mapper.Map\u003cSourceObject, DestObject\u003e(sourceObject);\n// output\n// destObject.Id = 1\n// destObject.Name = \"Source object\"\n// destObject.DateCreated = \"2018-01-01 00:00:00\"\n// destObject.Description = null\n// destObject.IsEnabled = false\n// destObject.Items = null\n```\n\nImplicitly map (no specified profile) two different objects with similar properties, only matching property names will get mapped:\n```csharp\nvar sourceObject = new SourceObject { Id = 1, Name = \"Source object\", DateCreated = new DateTime(2018, 1, 1) };\nvar destObject = Mapper.Map\u003cSourceObject, DestObject\u003e(sourceObject);\n\n// output\n// destObject.Id = 1\n// destObject.Name = \"Source object\"\n// destObject.DateCreated = \"2018-01-01 00:00:00\"\n// destObject.Description = null\n// destObject.IsEnabled = false\n// destObject.Items = null\n\n```\n\n### Profiles\n\nAnyMapper supports scanning for profiles in the current assembly using the following setup:\n\n```csharp\nMapper.Initialize();\n```\n\nYou can also specify profiles manually if you don't want to scan for them:\n\n```csharp\nvar profiles = new List\u003cProfile\u003e();\nprofiles.Add(new MyProfile());\nprofiles.Add(new CustomerProfile());\nprofiles.Add(new TypesProfile());\nMapper.Initialize(profiles);\n```\n\nSome additional options for finding profiles:\n```csharp\n// scan specified assemblies\nvar myAssembly1 = Assembly.Load(...assemblyPath);\nvar myAssembly2 = Assembly.Load(...assemblyPath);\nMapper.Initialize(myAssembly1, myAssembly2);\n\n// scan all assemblies in the application (performance will suffer in a large application)\nMapper.Initialize(MappingOptions.ScanAllAssemblies);\n```\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freplaysmike%2Fanymapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freplaysmike%2Fanymapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freplaysmike%2Fanymapper/lists"}