In the API controller I tried adding this line
AutoMapperConfig.Mapper.AssertConfigurationIsValid();
but got this error:
Severity Code Description Project File Line Suppression State
Error CS1061 'IMapper' does not contain a definition for 'AssertConfigurationIsValid' and no extension method 'AssertConfigurationIsValid' accepting a first argument of type 'IMapper' could be found (are you missing a using directive or an assembly reference?) SysManager.Web D:\_Siriusware\Main\SysManager\SysManager.Web\Areas\Guests\Controllers\PassesApiController.cs 35 Active
>>Hi everybody,
>>
>>We got that form working fine last time I tested (it was a while ago). Yesterday I tried to test it again (and I upgraded to the latest AutoMapper and prior to that my colleague also upgraded about a month or 2 ago) and I'm getting this error now:
>>
>>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
>>
>>Both classes (GstPass and EditPassViewModel) are quite complex. I have the following in the AutoMapper.config
>>
>>
>> CreateMap<GstPass, EditPassViewModel>()
>> //.ForMember(dest => dest.LastUse,
>> // opt => opt.ResolveUsing<TrimStringResolver>().FromMember(source => source.LastUse.Value.ToString()))
>> .ForMember(dest => dest.InHouseCardBalanceAndLimits, option => option.Ignore())
>> .ForMember(dest => dest.InHouseCardTransactions, option => option.Ignore())
>> .ForMember(dest => dest.BlReason,
>> opt => opt.ResolveUsing<TrimStringResolver>().FromMember(source => source.BlReason.ToString()));
>>
>>I'm wondering what can I do to figure out why I'm getting this error which is new as that form used to work before.
>>
>>Thanks in advance.
>
>Have you tried AssertConfigurationIsValid() ?
If it's not broken, fix it until it is.
My Blog