Reputation: 1258
I have been trying to create a automapper Custom value resolvers, but I seem to have missed some set up step as it can never seem to find
public abstract class ValueResolver<TSource, TDestination> : IValueResolver
So in the following snippet will not compile.
using DITest.Models; // This is where the SalesOrder class is
using AutoMapper;
namespace DITest.AutoMapper.SaleOrder
{
public class FullAddress : ValueResolver<SalesOrder, string>
{
protected override string ResolveCore(SalesOrder source)
{
return "foo bar";
}
}
}
I get the error message
The type or namespace name 'ValueResolver<,>' could not be found (are you missing a using directive or an assembly reference?)
Its say the using AutoMapper is not used.
In the past I have been naughty and hacked in a reference for lib\net45\AutoMapper.dll
Upvotes: 4
Views: 2330
Reputation: 3516
ValueResolver
is gone. IValueResolver
is the replacement. And there is also IMemberValueResolver
, as the docs say.
Upvotes: 1
Reputation: 21
Please try IMemberValueResolver
type instead of IValueResolver
. The AutoMapper had some upgraded things.
https://github.com/AutoMapper/AutoMapper/wiki/5.0-Upgrade-Guide
Upvotes: 2