Imports System.Globalization Imports AutoMapper Imports AutoMapper.Configuration Public Class MapperFactory Private Shared MapperConfig As Object 'Public Shared Function GetMapper() As Mapper ' MapperConfig = New MapperConfiguration(CreateMapperConfig()) ' MapperConfig.AssertConfigurationIsValid() ' Return MapperConfig.CreateMapper() 'End Function 'Private Shared Function CreateMapperConfig() As MapperConfigurationExpression ' Dim oConfig As New MapperConfigurationExpression() ' oConfig.CreateMap(Of String, Integer)().ConvertUsing(New IntegerTypeConverter()) ' oConfig.CreateMap(Of String, Decimal)().ConvertUsing(New DecimalTypeConverter()) ' oConfig.CreateMap(Of String, DateTime)().ConvertUsing(New DateTimeTypeConverter()) ' oConfig.CreateMap(Of Schemas.Orders.Input.MESOWebService, Schemas.Orders.Output.MESOWebService)() ' oConfig.CreateMap(Of Schemas.Orders.Input.MESOWebServiceEXIMVRG_ordersT025, Schemas.Orders.Output.MESOWebServiceEXIMVRG_ordersT025)() ' oConfig.CreateMap(Of Schemas.Orders.Input.MESOWebServiceEXIMVRG_ordersT026, Schemas.Orders.Output.MESOWebServiceEXIMVRG_ordersT026)() ' Return oConfig 'End Function Private Class DateTimeTypeConverter Implements ITypeConverter(Of String, DateTime) Public Function Convert(source As String, destination As Date, context As ResolutionContext) As Date Implements ITypeConverter(Of String, Date).Convert Return System.Convert.ToDateTime(source) End Function End Class Private Class IntegerTypeConverter Implements ITypeConverter(Of String, Integer) Public Function Convert(source As String, destination As Integer, context As ResolutionContext) As Integer Implements ITypeConverter(Of String, Integer).Convert Return System.Convert.ToInt32(source) End Function End Class Private Class DecimalTypeConverter Implements ITypeConverter(Of String, Decimal) Public Function Convert(source As String, destination As Decimal, context As ResolutionContext) As Decimal Implements ITypeConverter(Of String, Decimal).Convert Return System.Convert.ToDecimal(source, CultureInfo.InvariantCulture) End Function End Class End Class