MapsterMapper / MapsterMapper/Mapster
[Feature Request] add api to get differents properties(or fields) when map to exists dst?
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 5.2k
- Forks
- 410
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
Could be add some api to compare differents properties(or fields) with two instance of same class ?
i know we can use reflection,but performance slow.
like:
```C#
//same class (ClassAObj1 vs ClassAObj2)
var fieldNames= ClassAObj1.Diff(ClassAObj2); //Api-1 get different fieldnames,but not map
bool hasDifferents= ClassAObj1.MapDiff(ClassAObj2,out string[] fieldsName); //Api-2 get get different fieldnames and map them
//not same class (ClassAObj1 vs ClassBObj2)
var fieldNames= ClassAObj1.Diff(ClassBObj2); //Api-1 get different fieldnames,but not map
bool hasDifferents= ClassAObj1.MapDiff(ClassBObj2,out string[] fieldsName); //Api-2 get get different fieldnames and map them
```
//same like mapper's config it will use the global config(custom ignore some properties(or fields) ),that's will be better.
why need:
**if i got not differents,then i wont need to update to database.**
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue does not identify files, tests, or an entry point for the proposed Diff and MapDiff APIs. Start by locating Mapster's mapping configuration and generated or reflection-based mapping paths, then determine how comparisons, ignored properties, and same- versus cross-type mappings should be specified. Done means an agreed API and tests covering the requested comparison behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100