I have Job entity with those properties
public class Job: FullAuditedEntity, IMustHaveTenant
{
public string SpareParts { get; set; }
public string Tools { get; set; }
}
SpareParts
is convert to string from ICollection via automapper like this
.ForMember(a => a.SpareParts,
o => o.MapFrom(src => string.Join(";", src.SpareParts)))
I need to convert it from string to ICollection
I try to do it like this
configuration.CreateMap<Job, EditJobDto>()
.ForMember(x => x.SpareParts,
m => m.MapFrom(o => o.SpareParts.Split(';').ToList()));
But I get error at bracket after ';'
JobMapper.cs(51, 41): [CS0854] An expression tree may not contain a call or invocation that uses optional arguments
Where is my problem?