CARVIEW |
Select Language
HTTP/2 200
date: Tue, 22 Jul 2025 00:19:25 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-robots-tag: none
etag: W/"b331bbfd0931acad3c1c704bd32da219"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=iCI%2FK8L8T%2BiMC6iIgWjTJbgAgWpoIM4xlzpI60rsCnt7AvS0gYm8RReU5%2BRuQQovrBG%2FK9Uq%2F0BfYpVRwl9B%2BJ0VYE6Jenxy7IvOgBpBSbRAaKKemUKUs2vxvoNA6yMfYyVEqkBFLL27jqcjSy3q4lQxpFmA8iI2jVSHhqZc%2Fzsdy9pYxna8oDzX9ftUZG9Y%2Bld5GtX8HoTpcAw%2FPWhNKp1lkPA9JX2b9PYpcSTgq0hfZNzSs8hZxLJMMvncIcfc9JmMIoxYereLcwJ50d%2BgJw%3D%3D--beKOe24fE1xZjKkY--e6ekyE5SbgXMvfjiHNLJrw%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.262806239.1753143564; Path=/; Domain=github.com; Expires=Wed, 22 Jul 2026 00:19:24 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Wed, 22 Jul 2026 00:19:24 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: BCDC:22EF6D:A1D1:1039A:687ED90C
Home · MapsterMapper/Mapster Wiki · GitHub
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 370
Home
Arad Alvand edited this page Aug 10, 2022
·
20 revisions
Method | Description | Link |
---|---|---|
src.Adapt<Dest>() |
Mapping to new type | basic |
src.Adapt(dest) |
Mapping to existing object | basic |
query.ProjectToType<Dest>() |
Mapping from queryable | basic |
Convention & Data type support | data types |
Method | Description | Link |
---|---|---|
IMapper mapper = new Mapper() |
Create mapper instance | mappers |
mapper.Map<Dest>(src) |
Mapping to new type | |
mapper.Map(src, dest) |
Mapping to existing object |
Method | Description | Link |
---|---|---|
src.BuildAdapter() mapper.From(src)
|
Create builder | mappers |
.ForkConfig(config => ...) |
Inline configuration | config location |
.AddParameters(name, value) |
Passing runtime value | setting values |
.AdaptToType<Dest>() |
Mapping to new type | |
.AdaptTo(dest) |
Mapping to existing object | |
.CreateMapExpression<Dest>() |
Get mapping expression | |
.CreateMapToTargetExpression<Dest>() |
Get mapping to existing object expression | |
.CreateProjectionExpression<Dest>() |
Get mapping from queryable expression |
Method | Description | Link |
---|---|---|
TypeAdapterConfig.GlobalSettings |
Global config | config |
var config = new TypeAdapterConfig() |
Create new config instance | config instance |
src.Adapt<Dest>(config) |
Passing config to mapping | |
new Mapper(config) |
Passing config to mapper instance | |
src.BuildAdapter(config) |
Passing config to builder | |
config.RequireDestinationMemberSource |
Validate all properties are mapped | config validation |
config.RequireExplicitMapping |
Validate all type pairs are defined | config validation |
config.AllowImplicitDestinationInheritance |
Use config from destination based class | inheritance |
config.AllowImplicitSourceInheritance |
Use config from source based class | inheritance |
config.SelfContainedCodeGeneration |
Generate all nested mapping in 1 method | TextTemplate |
config.Compile() |
Validate mapping instruction & cache | config validation |
config.CompileProjection() |
Validate mapping instruction & cache for queryable | |
config.Clone() |
Copy config | config instance |
config.Fork(forked => ...) |
Inline configuration | config location |
Method | Description | Link |
---|---|---|
IRegister |
Interface for config scanning | config location |
config.Scan(...assemblies) |
Scan for config in assemblies | config location |
config.Apply(...registers) |
Apply registers directly | config location |
Method | Description | Link |
---|---|---|
config.Default |
Get setting applied to all type pairs | config |
TypeAdapterConfig<Src, Dest>.NewConfig() config.NewConfig<Src, Dest>()
|
Create setting applied to specific type pairs | config |
TypeAdapterConfig<Src, Dest>.ForType() config.ForType<Src, Dest>()
|
Get setting applied to specific type pairs | config |
config.ForType(typeof(GenericPoco<>),typeof(GenericDto<>)) |
Get setting applied to generic type pairs | config |
config.When((src, dest, mapType) => ...) |
Get setting that applied conditionally | config |
config.ForDestinationType<Dest>() |
Get setting that applied to specific destination type | config |
Configuration for nested mapping | nested mapping |
Method | Description | Apply to queryable | Link |
---|---|---|---|
AddDestinationTransform |
Clean up data for a specific type | x | setting values |
AfterMapping |
Add steps after mapping done | before-after | |
AvoidInlineMapping |
Skip inline process for large type mapping | object reference | |
BeforeMapping |
Add steps before mapping start | before-after | |
ConstructUsing |
Define how to create object | x | constructor |
EnableNonPublicMembers |
Mapping non-public properties | non-public | |
EnumMappingStrategy |
Choose whether mapping enum by value or by name | data types | |
Fork |
Add new settings without side effect on main config | x | nested mapping |
GetMemberName |
Define how to resolve property name | x | custom naming |
Ignore |
Ignore specific properties | x | ignore |
IgnoreAttribute |
Ignore specific attributes annotated on properties | x | attribute |
IgnoreIf |
Ignore conditionally | x | ignore |
IgnoreMember |
Setup rules to ignore | x | rule based |
IgnoreNonMapped |
Ignore all properties not defined in Map
|
x | ignore |
IgnoreNullValues |
Not map if src property is null | shallow & merge | |
Include |
Include derived types on mapping | inheritance | |
IncludeAttribute |
Include specific attributes annotated on properties | x | attribute |
IncludeMember |
Setup rules to include | x | rule based |
Inherits |
Copy setting from based type | x | inheritance |
Map |
Define property pairs | x | custom mapping |
MapToConstructor |
Mapping to constructor | x | constructor |
MapToTargetWith |
Define how to map to existing object between type pair | custom conversion | |
MapWith |
Define how to map between type pair | x | custom conversion |
MaxDepth |
Limit depth of nested mapping | x | object reference |
NameMatchingStrategy |
Define how to resolve property's name | x | custom naming |
PreserveReference |
Tracking reference when mapping | object reference | |
ShallowCopyForSameType |
Direct assign rather than deep clone if type pairs are the same | shallow & merge | |
TwoWays |
Define type mapping are 2 ways | x | 2-ways & unflattening |
Unflattening |
Allow unflatten mapping | x | 2-ways & unflattening |
UseDestinationValue |
Use existing property object to map data | readonly-prop |
Annotation | Description | Link |
---|---|---|
[AdaptMember(name)] |
Mapping property to different name | attribute |
[AdaptIgnore(side)] |
Ignore property from mapping | attribute |
[UseDestinationValue] |
Use existing property object to map data | attribute |
[AdaptTo] [AdaptFrom] [AdaptTwoWays]
|
Add setting on POCO class | location |
[Mapper] [GenerateMapper] [PropertyType]
|
Define setting for code generation | Mapster.Tool |
Plugin | Method | Description |
---|---|---|
Async |
setting.AfterMappingAsync builder.AdaptToTypeAsync
|
perform async operation on mapping |
Debugging | config.Compiler = exp => exp.CompileWithDebugInfo() |
compile to allow step into debugging |
Dependency Injection | MapContext.Current.GetService<IService>() |
Inject service into mapping logic |
EF 6 & EF Core | builder.EntityFromContext |
Copy data to tracked EF entity |
FEC | config.Compiler = exp => exp.CompileFast() |
compile using FastExpressionCompiler |
Immutable | config.EnableImmutableMapping() |
mapping to immutable collection |
Json.net | config.EnableJsonMapping() |
map json from/to poco and string |
Plugin | Tool | Description |
---|---|---|
Mapster.Tool | dotnet mapster |
generate DTOs and mapping codes on build |
TextTemplate | t4 |
generate mapping codes using t4 |
- Configuration
- Config inheritance
- Config instance
- Config location
- Config validation & compilation
- Config for nested mapping
- Custom member matching logic
- Constructor mapping
- Before & after mapping
- Setting values
- Shallow & merge mapping
- Recursive & object references
- Custom conversion logic
- Inheritance
Clone this wiki locally
You can’t perform that action at this time.