Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
AutoMapper throws an error - how to figure out?
Message
 
 
À
14/05/2016 04:04:16
Information générale
Forum:
ASP.NET
Catégorie:
Produits tierce partie
Versions des environnements
Environment:
C# 5.0
OS:
Windows 10
Database:
MS SQL Server
Divers
Thread ID:
01636216
Message ID:
01636382
Vues:
41
>>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 :(
>
>Not the problem but what is this line for ? :
.ForMember(dest => dest.Operator, opt => opt.MapFrom(source => source.Operator ))
I was thinking that this @Operator property looks rather weird so may be I'll try to map them manually. But when I tried to map, it did show up as Operator and not @Operator as I thought it may.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform