I need to automap BLTriangleStartupInfoModel to the TriangleStartUpInfoModel class where TriangleStartUpInfoModel is the source class..
The problem is the parameters between the classes are not a one to one match up, the paramters are lists, and one list parameter is contained in the TriangleStartUpInfoModel but not in the TriangleStartUpInfoModel class.
That parameter is used to set a child property.
Below is a listing of all the classes involve.
I am not quite sure how to use the .ConstructUsing method to accomplish this.
I need to map a ILIst<string> to an IList<Row> where Row is class that contains a single property which is a string
I need to map a ILIst<int> to an IList<Column> where Column is class that contains a single property which is a int.
Any help would be appreciated.
CreateMap<BLTriangleStartupInfoModel, TriangleStartUpInfoModel>()
.ConstructUsing(x => new TriangleStartUpInfoModel(??????, ??????, new List<ILink>()));
public class TriangleStartUpInfoModel : TriangleModel
, ITriangleStartUpInfoModel
{
public IList<IRow> Rows { get; }
public IList<IColumn> Columns { get; }
public TriangleStartUpInfoModel(IList<IRow> rows
, IList<IColumn> columns
, IList<ILink> links = null) : base(links)
{
Rows = rows;
Columns = columns;
}
}
public class BLTriangleStartupInfoModel : BLiModel
, IBLTriangleStartupInfoModel
{
public IList<string> Rows { get; }
public IList<int> Columns{ get; }
public BLTriangleStartupInfoModel(IList<string> rows, IList<int> columns)
{
Rows = rows;
Columns = columns;
}
}
public class BLiModel : IBLModel
{
}
public class TriangleModel : TaskModel
, ITriangleModel
{
public TriangleModel(IList<ILink> links) : base(links)
{
}
}
public class TaskModel : IModel
{
public IList<ILink> Links { get; set; }
public TaskModel(IList<ILink> links)
{
Links = links;
}
}
public class Row : IRow
{
public string RowValue { get; set; }
}
public class Column :IColumn
{
public int ColumnValue { get; set; }
}