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

AutoMapperMappingException: Missing type map configuration or unsupported mapping. #689

Closed
maqeelqureshi opened this issue Aug 27, 2020 · 9 comments
Assignees

Comments

@maqeelqureshi
Copy link

maqeelqureshi commented Aug 27, 2020

Following Mapping types are missing,

UserIdentityRoleClaim -> RoleClaimDto`1

PagedList`1 -> IdentityRoleClaimsDto

PagedList`1 -> IdentityRoleClaimsDto

To Reproduce

Clone code,
Run migration and seed
Add Role claims

@skoruba
Copy link
Owner

skoruba commented Aug 27, 2020

Thanks for reporting this issue, did you get this exception with latest version from master?
Thanks

@maqeelqureshi
Copy link
Author

Thanks for reporting this issue, did you get this exception with latest version from master?
Thanks

Yes, its is producible on master branch.

@skoruba
Copy link
Owner

skoruba commented Aug 27, 2020

Ok, let me check it. Can you send a PR with your fix? Thanks

@maqeelqureshi
Copy link
Author

Not sure how to create pull request from source-tree.

Adding following mapping to IdentityServer4.Admin\src\Skoruba.IdentityServer4.Admin.BusinessLogic.Identity\Mappers\IdentityMapperProfile.cs resolves this issue,
CreateMap<UserIdentityRoleClaim, RoleClaimDto>(MemberList.Source);
CreateMap<RoleClaimDto, UserIdentityRoleClaim>(MemberList.Source);
CreateMap<UserIdentityRoleClaim, RoleClaimDto>(MemberList.Destination);

@skoruba
Copy link
Owner

skoruba commented Aug 27, 2020

Oki, I will add it manualy. Thank you @maqeelqureshi 👍

@fuentco
Copy link

fuentco commented Aug 31, 2020

Hello,

Could you point me in the direction to solve this issue? I see that UserIdentityRoleClaim class (Skoruba.IdentityServer4.Admin.EntityFramework.Shared.Entities.Identity) is empty.

Regards,

erick

@zinkpad
Copy link
Contributor

zinkpad commented Sep 10, 2020

Hi,

I added these lines to IdentityMapperProfile.cs to resolve automapper exceptions with UserLoginInfo -> UserProviderDto (when you list user providers) and RoleClaimDto exceptions:

            // Fix user providers error
            CreateMap<UserLoginInfo, UserProviderDto<TKey>>(MemberList.Destination);

            // Fix role claims
            CreateMap<IdentityRoleClaim<TKey>, RoleClaimDto<TKey>>(MemberList.Source)
                .ForMember(x => x.ClaimId, opt => opt.MapFrom(src => src.Id));
            CreateMap<RoleClaimDto<TKey>, IdentityRoleClaim<TKey>>(MemberList.Source)
                .ForMember(x => x.Id, opt => opt.MapFrom(src => src.ClaimId));
            CreateMap<IdentityRoleClaim<TKey>, RoleClaimDto<TKey>>(MemberList.Destination)
                .ForMember(x => x.ClaimId, opt => opt.MapFrom(src => src.Id));
            // end fix role claims

I think mappings needs a review.

@skoruba
Copy link
Owner

skoruba commented Sep 10, 2020

Hi guys, thanks for your fixes. I will definitelly review whole mapping for API. I am busy right now, so that is the reason why this issue is stil open.

skoruba added a commit that referenced this issue Sep 12, 2020
@skoruba skoruba mentioned this issue Sep 12, 2020
@skoruba
Copy link
Owner

skoruba commented Sep 12, 2020

Thank you! Fixed in 1.0.0-rc3 #703

@skoruba skoruba closed this as completed Sep 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants