0
Answer

An exception of type 'AutoMapper.AutoMapperMappingException'

Karthik Kumar

Karthik Kumar

8y
827
1
hai i am new to the mapping.when i am trying to map this error coming please help me
 
An exception of type 'AutoMapper.AutoMapperMappingException' occurred in AutoMapper.dll but was not handled in user code
 
public LoadSheddingInputsContainer GetLoadSheddingInputs(int ldzId, string gasDayFlag)
{
var domain = this.dmsRepository.GetInputs(ldzId, gasDayFlag);
var models = Mapper.Map<InputsContainer>(domain);//here exception showing
return models;
}
}
 my code about mapping...
 
Mapper.CreateMap<Shared.Domain.Inputs, Shared.Models.LoadSheddingInputs>();
Mapper.CreateMap<Shared.Models.Inputs, Shared.Domain.LoadSheddingInputs>()
 
public InputsContainer GetInputs(int ldzId, string gasDayFlag)
{
var domain = this.Repository.GetInputs(ldzId, gasDayFlag);
var models = Mapper.Map<InputsContainer>(domain);
return models;
}
 
//mapper initilizer
FluentMapper.Initialize(a => a.AddMap(new InputsMapper()));
 
 
/// <summary>
/// Inputs Mapper
/// </summary>
public class InputsMapper : EntityMap<Inputs>
{
/// <summary>
/// Initializes a new instance of the <see cref="InputsMapper"/> class.
/// </summary>
public InputsMapper()
{
Map(p => p.Time).ToColumn("add");
Map(p => p.Firm).ToColumn("add");
Map(p => p.SO).ToColumn("add");
Map(p => p.Hours).ToColumn("add");
}
}
}