MapsterMapper / MapsterMapper/Mapster

Separate namespaces to avoid ambiguous references

Open
#705 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

We're using Mapster quite to the maximum extent that is somehow possible. With reflection we dynamically generate base mappings for polymorphic DTOs. Now the issue is, that we need to generate a base implementation that uses AfterMappingAsync.

Since the extensions for that are in the very same namespace and class than the base extensions of Mapster, we have a collision and need to work with extern alias which makes using it a pain. Now we need to also use global::Mapster everywhere else.

Wouldn't it be easier to just put them into a Mapster.Async namespace? I see no benefit for identical namespaces and types other than confusion and unncessary pain to work with it.

Obviously working with Reflection is an edge case here, but still. I feel like this is not very good design. I would avoid using the same namespaces and classes at all costs as it also makes navigation in the source code a lot easier and more transparent.

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 locating the async extensions containing AfterMappingAsync and the base Mapster extensions they currently share a namespace and class with. Review references and reflection-generated mappings to assess the namespace change; done means async and base APIs can be used without extern alias or global::Mapster qualification.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.