我正在尝试使用Mapster映射来自表示为Interface的数据提供程序的复杂对象。 我的界面:
<img src="<?php echo 'data:image/png;base64,'.base64_encode(file_get_contents(<cdn-img-link>));?>">
我想将从上述派生的类映射到也从上述接口派生的一组新类。
我的接班人:
public interface ICase
{
string CaseId { get; set; }
List<IPortfolio> Portfolios { get; set; }
}
public interface IPortfolio
{
string FirstName { get; set; }
string LastName { get; set; }
int Id { get; set; }
}
我的Mapster配置是:
public class Case : ICase
{
public Case()
{
Portfolios = new List<IPortfolio>();
}
public string CaseId { get; set; }
public List<IPortfolio> Portfolios { get; set; }
}
public class Portfolio : IPortfolio
{
public string FirstName { get; set; }
public string LastName { get; set; }
public int Id { get; set;}
}
运行此命令时出现错误
“ IPortfolio”类型没有默认的构造函数,请使用“ ConstructUsing”
我找不到有关Mapster的“ ConstructUsing”的大量文档。使用它的正确方法是什么?为什么它似乎不起作用?