Skip to content
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

Mapster tool How to declare custom mapping. #682

Open
Alexandr-Pletnev opened this issue Mar 4, 2024 · 0 comments
Open

Mapster tool How to declare custom mapping. #682

Alexandr-Pletnev opened this issue Mar 4, 2024 · 0 comments

Comments

@Alexandr-Pletnev
Copy link

Alexandr-Pletnev commented Mar 4, 2024

Hello all.

We want to use mapster tool to auto-generate DTOs and Mappers.
But we don't understand how we can declare custom mapping.

For example:

var builder = config.AdaptTo("[name]Dto", MapType.Map)
      .ForType<ProjectDocument>(cfg =>
      {
          cfg.Map(src => src.ProjectXml, typeof(string), "ProjectXmlAsJson", srcValue => "some logic to return dest value");

      });

We want to implement "some logic to return dest value". We need to serialize src value to string.

How can we do it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant