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

How to use IRegister in asp.net 4.7.2 projects? #733

Open
netty2019 opened this issue Oct 25, 2024 · 1 comment
Open

How to use IRegister in asp.net 4.7.2 projects? #733

netty2019 opened this issue Oct 25, 2024 · 1 comment

Comments

@netty2019
Copy link

My project is asp.net 4.7.2 MVC, Mapster version 7.2.0

Configuring IRegister does not work

public class HjCollectDtlMapper : IRegister
{
    public void Register(TypeAdapterConfig config)
    {
        config.ForType<SaveDtlInput, HjCollectDtl>()
            .Map(u => u.IsManual, p => p.IsManual ? "Y" : "N");
    }
}
@vchc
Copy link

vchc commented Oct 30, 2024

Do you scan for IRegister types at the startup?

TypeAdapterConfig.GlobalSettings.Scan(typeof(HjCollectDtlMapper).Assembly);

Or add them explicitly?

TypeAdapterConfig.GlobalSettings.Apply(new HjCollectDtlMapper());

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

2 participants