1
我更新了相對較舊項目的Automapper軟件包。而且我很難理解這堂課需要改變什麼(或者如果問題存在於其他地方)。程序包更新後自動映射器ITypeConverter錯誤
我越來越:
「 'ResolutionContext' 不包含SourceValue的定義,並沒有擴展方法......」
public class PagedListConverter<T1, T2> : ITypeConverter<IPagedList<T1>, IPagedList<T2>>
{
public IPagedList<T2> Convert(ResolutionContext context)
{
var models = (StaticPagedList<T1>)context.SourceValue; // Error
var viewModels = models.Select(Mapper.Map<T1, T2>);
return new StaticPagedList<T2>(viewModels, models.PageNumber,
models.PageSize, models.TotalItemCount);
}
}
非常感謝:)它像一個魅力:) –