Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

C# Exception thrown: mapping is missing

I am getting this error and I am not sure where to start. I have setup the mapping in the UnityConfig class, but it seems like it can also be something in the Settings not being initalized.

Console App

static void Main(string[] args)
{
    IUnityContainer _container;
    //Initialize
    _container = UnityConfig.GetConfiguredContainer();

Error line

var exportModel = Mapper.Map<PlanDefinition>(model);

UnityConfig.cs

public class UnityConfig
{
            Mapper.CreateMap<TemplateModel, PlanDefinition>();
            MapperBase.InitializeMappings();

Exception

{Trying to map TemplateModel to PlanDefinition.}
Message: "Settings has not been initalized."
    StackTrace: "   at OrderTemplateTool.Web.Utility.SiteSettings.get_Instance() in C:\\WebProjects\\COTT\\COTT\\OrderTemplateTool.Web\\Utility\\SiteSettings.cs:line 18\r\n   at OrderTemplateTool.Web.App_Start.Mappings.Fhir.FhirTypeConverter`2.get_BaseUri() in C:\\WebProjects\\COTT\\COTT\\OrderTemplateTool.Web\\App_Start\\Mappings\\Fhir\\FhirTypeConvertercs.cs:line 63\r\n   at OrderTemplateTool.Web.App_Start.Mappings.Fhir.TemplateModelTypeConverter.Convert(ResolutionContext context) in C:\\WebProjects\\COTT\\COTT\\OrderTemplateTool.Web\\App_Start\\Mappings\\Fhir\\TemplateModelTypeConverter.cs:line 31\r\n   at AutoMapper.DeferredInstantiatedConverter`2.Convert(ResolutionContext context)\r\n   at AutoMapper.MappingExpression`2.<>c__DisplayClass23.<ConvertUsing>b__22(ResolutionContext context)\r\n   at AutoMapper.Mappers.TypeMapObjectMapperRegistry.CustomMapperStrategy.Map(ResolutionContext context, IMappingEngineRunner mapper)\r\n   at AutoMapper.Mappers.TypeMapMapper.Map(ResolutionContext context, IMappingEngin
eRunner mapper)\r\n   at AutoMapper.MappingEngine.AutoMapper.IMappingEngineRunner.Map(ResolutionContext context)"

Comments