无法创建 Automapper 自定义值解析器

Ash*_*our 5 automapper

我一直在尝试创建一个自动映射器自定义值解析器,但我似乎错过了一些设置步骤,因为它似乎永远找不到

 public abstract class ValueResolver<TSource, TDestination> : IValueResolver
Run Code Online (Sandbox Code Playgroud)

所以在下面的代码片段中不会编译。

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"; 
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

我收到错误消息

找不到类型或命名空间名称“ValueResolver<,>”(您是否缺少 using 指令或程序集引用?)

它说使用 AutoMapper 没有使用。

过去我很调皮,在 lib\net45\AutoMapper.dll 的参考中被黑