MapsterMapper / MapsterMapper/Mapster

Add an overload to the Adapt method to allow using a local, temporary configuration.

Open
#833 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

config features feature request
Dominant language
C#
Stars
5.2k
Forks
410
Avg merge
2d 12h
Merged PRs (30d)
6

Description

Previously, I added two overload for method Adapt that locally and temporarily modified the global configuration.
```
public static TDestination Adapt(this object? source, Action configAction)
public static TDestination Adapt(this object? source, Action> configAction)
```

What do you think about adding the following the overload to modify an existing object?
`public static TDestination Adapt(this object? source, TDestination destination, Action> SetterAction)`

And add an overload to `ProjectToType ` method that locally and temporarily modified the global configuration.
The proposed overload:
`public static IQueryable ProjectToType(this IQueryable source, TypeAdapterConfig? config = null, Action> SetterAction)`

Of course, the following method already exists in the current version and uses a `config ` instead of the global setting.
`public static IQueryable ProjectToType(this IQueryable source, Type destinationType, TypeAdapterConfig? config = null)`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing Adapt overloads and ProjectToType methods, especially how they handle TypeAdapterConfig and local configuration actions. Done means adding the proposed destination-object and queryable overloads with temporary configuration behavior while preserving the existing config-based API; the issue does not name files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.