aspnetboilerplate: Missing type map configuration or unsupported mapping in Abp version 4.8.0

In the .Net core project, the Abp version was 4.6.0, the Automapper didn’t have any mapping problem with mentioned classes but after updated to Abp version 4.8.0 the following error had occurred:

Error:

Missing type map configuration or unsupported mapping.
Mapping types:
HotelbedsAvailabilityByGeolocationInputDto -> HotelbedsAvailabilityByGeolocationRequest
CompanyName.Project.InternationalServices.Dto.HotelbedsAvailabilityByGeolocationInputDto -> CompanyName.Project.InternationalServices.HotelbedsAvailabilityByGeolocationRequest
   at lambda_method(Closure , HotelbedsAvailabilityByGeolocationInputDto , HotelbedsAvailabilityByGeolocationRequest , ResolutionContext )
   at lambda_method(Closure , Object , Object , ResolutionContext )
   at AutoMapper.Mapper.AutoMapper.IMapper.Map[TDestination](Object source) in C:\projects\automapper\src\AutoMapper\Mapper.cs:line 212
   at CompanyName.Project.InternationalServices.HotelbedsUnitAppService.AvailabilityByGeolocationCodeAsync(HotelbedsAvailabilityByGeolocationInputDto hotelbedsAvailabilityByGeolocationInputDto) in D:\Projects\Hub\src\CompanyName.Project.Application\Services\International\HotelBeds\HotelbedsUnitAppService.cs:line 53
   at lambda_method(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()

Classes:

public class HotelbedsAvailabilityByGeolocationInputDto : HotelbedsAvailabilityBaseDto
{
    public GeolocationDto geolocation { get; set; }
}
public abstract class HotelbedsAvailabilityBaseDto
{
    public StayDto stay { get; set; }
    public OccupancyDto[] occupancies { get; set; }
    public override string ToString()
    {
        return $"stay.checkIn is: {stay.checkIn} and stay.checkOut is {stay.checkOut}";
    }
}
public class GeolocationDto
{
    public float latitude { get; set; }
    public float longitude { get; set; }
    public int radius { get; set; }
    public string unit { get; set; }
}
public class HotelbedsAvailabilityByGeolocationRequest : HotelbedsAvailabilityBase
{
    public Geolocation geolocation { get; set; }
}
public abstract class HotelbedsAvailabilityBase
{
    public Stay stay { get; set; }
    public Occupancy[] occupancies { get; set; }
    public override string ToString()
    {
        return $"stay.checkIn is: {stay.checkIn} and stay.checkOut is {stay.checkOut}";
    }
}
public class Geolocation
{
    public float latitude { get; set; }
    public float longitude { get; set; }
    public int radius { get; set; }
    public string unit { get; set; }
}
public class StayDto
{
    public string checkIn { get; set; }
    public string checkOut { get; set; }
}
public class OccupancyDto
{
    public int rooms { get; set; }
    public int adults { get; set; }
    public int children { get; set; }
}

In the CustomDtoMapper file:

configuration.CreateMap<HotelbedsAvailabilityByGeolocationRequest, HotelbedsAvailabilityByGeolocationInputDto>();

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 30 (14 by maintainers)

Most upvoted comments

@amendez1000, You just saved me from hours of troubles… this: [AutoMapFrom(typeof(Branch))] public class CreateBranchDto : FullAuditedEntityDto

To

[AutoMapTo(typeof(Branch))] public class CreateBranchDto : FullAuditedEntityDto

did the trick for me

I have the appropriate CreateMap calls (like I did prior to updating to v7.2.3) and am also running into the same error. CustomDtoMapper received minimal changes, but the code looks like it should be supported (didn’t change the way mappings work that I can see).

Visited here and didn’t notice anything I’m not already doing (any calls to ObjectMapper.Map should have all the mappings configured) - any other ideas on what to check?