After updating automapper version from 4.2.1 to 5.0.0 I got compilateion error that SourceValue is missing. Here is my example
public class DraftLayoutCellPropertiesConverter : ITypeConverter<DraftLayoutCell, DraftGamePeriodDraftLayoutViewModel>
{
public DraftGamePeriodDraftLayoutViewModel Convert(ResolutionContext context)
{
var input = context.SourceValue as DraftLayoutCell;
var result = new DraftGamePeriodDraftLayoutViewModel();
if (input != null)
{
What should be the replacement of that property? Is that the best way to do custom converters? I was expecting the update will not break existing code as there are many people using the app.
In Automapper 5, The interface ITypeConverter
changed, you need to update your implementation:
public class DraftLayoutCellPropertiesConverter : ITypeConverter<DraftLayoutCell, DraftGamePeriodDraftLayoutViewModel>
{
public DraftGamePeriodDraftLayoutViewModel Convert(DraftLayoutCell source, DraftGamePeriodDraftLayoutViewModel destination, ResolutionContext context)
{
var input = source;
...
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With