MapsterMapper / MapsterMapper/Mapster
dotnet mapper ... -p generates code that can't be compiled.
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 5.2k
- Forks
- 410
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
We have POCOs with the same type name in different namespaces.
Adding `-p` fixes the ambiguous reference, but generates enum mapping like
```
Mapster.Utils.Enum.Parse(Mapster.Utils.Enum.ToString()),
```
that fails to compile with error
```
The type or namespace name 'Utils' does not exist in the namespace 'xxxxxxx'
```
Same for `Mapster.TypeAdapter`
To fix, please render
````
using Mapster;
using Mapster.Utils;
````
and non-qualified `Enum.Parse()...` even if **-p** is requested.
Thanks
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
Start by locating the dotnet mapper code-generation path that renders Enum and TypeAdapter references, then reproduce the case with same-named POCOs in different namespaces and the -p option. Done means the generated C# uses Mapster and Mapster.Utils imports with non-qualified references and compiles successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100