Skip to content

feat mapster tool - #1011

Open
DocSvartz wants to merge 7 commits into
MapsterMapper:developmentfrom
DocSvartz:feat-MapsterTool--publish
Open

feat mapster tool #1011
DocSvartz wants to merge 7 commits into
MapsterMapper:developmentfrom
DocSvartz:feat-MapsterTool--publish

Conversation

@DocSvartz

Copy link
Copy Markdown
Contributor

No description provided.

@DocSvartz

This comment was marked as resolved.

@DocSvartz
DocSvartz requested a review from andrerav August 20, 2026 09:16
@DocSvartz

DocSvartz commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

@andrerav
That is, if you emulate a cases that is not currently supported:

 public interface IMyTypeMapper
 {
     internal AddressDTO Map(Address p1);
     internal Expression<Func<AddressDTO, Address>> Projection { get; }
 }

or

internal interface IMyTypeMapper
{
    internal AddressDTO Map(Address p1);
    internal Expression<Func<AddressDTO, Address>> Projection { get; }
}

emulation step

  1. replace Address to internal

internal class Address

  1. in TypeDefinitions set

IsInternal = false,

we get valid mapper :

public partial class CustomerMapper : IMyTypeMapper 
{
    internal AddressDTO Map(Address p1)
    {
        return p1 == null ? null : new AddressDTO()
        {
            Id = p1.Id,
            City = p1.City,
            Country = p1.Country
        };
    }
    AddressDTO TemplateTest.IMyTypeMapper.Map(Address p1)
    {
        return p1 == null ? null : new AddressDTO()
        {
            Id = p1.Id,
            City = p1.City,
            Country = p1.Country
        };
    }
    internal Expression<Func<AddressDTO, Address>> Projection => p2 => new Address()
    {
        Id = p2.Id,
        City = p2.City,
        Country = p2.Country
    };
    Expression<Func<AddressDTO, Address>> TemplateTest.IMyTypeMapper.Projection => p2 => new Address()
    {
        Id = p2.Id,
        City = p2.City,
        Country = p2.Country
    };
}

I thought this shouldn't work, but the assembly with this class compiles and the mapper itself works when cast to the interface.🤔

…ic interfaces with internal member

and test refactoring
@DocSvartz

DocSvartz commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

@andrerav If I'm not mistaken in the current implementation😃

Now mapper members are created correctly depending on the public/internal access modifiers specified for it or using for maping internal clases.

And IsInternal continues to work as before, forcing the creation of an internal mapper with an internal members.

1) property or method maks as public
2) property or method using only public clases
3) not using IsInternal atrribute
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

Successfully merging this pull request may close these issues.

1 participant