InvalidCastException: Object must implement IConvertible
Getting the subject line exception; Not sure what the problem is. Using NuGet package for Mapster and VB.Net. Any help/resolution much appreciated! Steps to reproduce:
'-------------------------------------------------------------------------------------------
'Run this using LinqPad 5 Beta, current version 5.05.02 (necessary for the Nuget package below)
'Add latest Nuget package for "Mapster" (AutoMapper-like module for converting POCOs etc.)
'Add the 3 namespaces from Mapster to this query
'Run it and see the exception thrown
Sub Main
TypeAdapterConfig(Of Order, OrderVM).NewConfig()
Dim order AS Order = New Order With {.Id = 1, .OrderDate = DateTime.Now }
Dim orderVM As OrderVM = New OrderVM()
'This is throwing InvalidCastException: Object must implement IConvertible.
orderVM = order.Adapt(orderVM)
orderVM.Dump
End Sub
Class Order
Public Id As Int32
Public OrderDate As DateTime
End Class
Class OrderVM
Public Id As Int32
Public OrderDate As DateTime
End Class
'-------------------------------------------------------------------------------------------
'Run this using LinqPad 5 Beta, current version 5.05.02 (necessary for the Nuget package below)
'Add latest Nuget package for "Mapster" (AutoMapper-like module for converting POCOs etc.)
'Add the 3 namespaces from Mapster to this query
'Run it and see the exception thrown
Sub Main
TypeAdapterConfig(Of Order, OrderVM).NewConfig()
Dim order AS Order = New Order With {.Id = 1, .OrderDate = DateTime.Now }
Dim orderVM As OrderVM = New OrderVM()
'This is throwing InvalidCastException: Object must implement IConvertible.
orderVM = order.Adapt(orderVM)
orderVM.Dump
End Sub
Class Order
Public Id As Int32
Public OrderDate As DateTime
End Class
Class OrderVM
Public Id As Int32
Public OrderDate As DateTime
End Class