Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
AutoMapper throws an error - how to figure out?
Message
 
 
General information
Forum:
ASP.NET
Category:
Third party products
Environment versions
Environment:
C# 5.0
OS:
Windows 10
Database:
MS SQL Server
Miscellaneous
Thread ID:
01636216
Message ID:
01636328
Views:
53
So, I am still getting the error :(
AutoMapper.AutoMapperMappingException was unhandled by user code
  HResult=-2146233088
  Message=Missing type map configuration or unsupported mapping.

Mapping types:
GstPass - EditPassViewModel
Siriusware.Models.GstPass -> SysManager.Web.Areas.Guests.Models.EditPassViewModel

Destination path:
EditPassViewModel

Source value:
Siriusware.Models.GstPass
  Source=AutoMapper
  StackTrace:
       at SysManager.Web.Areas.Guests.Controllers.GstPassApiController.GetGuestPass(Int64 id) in D:\_Siriusware\Main\SysManager\SysManager.Web\Areas\Guests\Controllers\PassesApiController.cs:line 36
       at lambda_method(Closure , Object , Object[] )
       at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
       at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
       at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
  InnerException: 
My mapping is defined this way:
 //Post
            CreateMap<EditPassViewModel, GstPass>().IgnoreAllNonExisting();

            //GET
            CreateMap<GstPass, EditPassViewModel>().IgnoreAllNonExisting()
            //.ForMember(dest => dest.LastUse,
            //    opt => opt.ResolveUsing<TrimStringResolver>().FromMember(source => source.LastUse.Value.ToString()))

            .ForMember(dest => dest.Operator, opt => opt.MapFrom(source => source.Operator ))
            .ForMember(dest => dest.BlReason,
                   opt => opt.ResolveUsing<TrimStringResolver>().FromMember(source => source.BlReason.ToString()));
I've searched the project and I found many models with the @Operator string property. They all work, so something else may be at play.

I really don't know what else may I try to fix it :(
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform