-
Notifications
You must be signed in to change notification settings - Fork 119
feat(Mapping): Support Mapping.Mapster #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/Data/Mapping/Masa.Contrib.Data.Mapping.Mapster/DefaultMappingConfigProvider.cs
Outdated
Show resolved
Hide resolved
|
|
||
| protected virtual TypeAdapterConfig GetConfigByCache(Type sourceType, Type destinationType, MapOptions? options) | ||
| { | ||
| TypeAdapterConfig? config = _store.GetOrAdd( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use lazy or ManualMemoryCache?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand what you mean, here is the configuration that tries to get the mapping relationship when the user is mapped
src/Data/Mapping/Masa.Contrib.Data.Mapping.Mapster/DefaultMappingConfigProvider.cs
Outdated
Show resolved
Hide resolved
src/Data/Mapping/Masa.Contrib.Data.Mapping.Mapster/DefaultMappingConfigProvider.cs
Outdated
Show resolved
Hide resolved
src/Data/Mapping/Masa.Contrib.Data.Mapping.Mapster/Internal/InvokeBuilder.cs
Outdated
Show resolved
Hide resolved
| OrderItem = new OrderItem("Teach you to learn Dapr hand by hand", 49.9m) | ||
| }; | ||
| var order = mapper.Map<Order>(request);// 将request映射到新的对象 | ||
| var order = mapping.Map<Order>(request);// 将request映射到新的对象, 源对象与目标对象属性名称、类型一致的参数会自动映射、或者目标对象的构造函数参数名称(不区分大小写)、类型与源对象参数一致的,会通过构造函数映射 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mapping rules require a more detailed description, even a new title
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
processed
| public void TestAddMultiMapping() | ||
| { | ||
| _services.AddMapping(); | ||
| var mappings = _services.BuildServiceProvider().GetServices<IMapper>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mappings -> mapper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
processed
doddgu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.