I have two class TenantRestrictSourceEntity
, TenantRestrictSource
and mapper profile
CreateMap<TenantRestrictSourceEntity, TenantRestrictSource>()
.ForMember(dest => dest.Tenant, opt => opt.Ignore());
public class TenantRestrictSourceEntity
{
public string SourceType { get; set; }
public bool? Enable { get; set; }
public int TenantId { get; set; }
}
public sealed class TenantRestrictSource
{
public int Id { get; set; }
public string SourceType { get; set; }
public bool Enable { get; set; }
public int TenantId { get; set; }
public Tenant Tenant { get; set; }
}
When I map one TenantRestrictSourceEntity
to one TenantRestrictSource
with Mapper.Map(tenantRestrictSourceEntity, tenantRestrictSource)
. Everything works fine. Tenant property was ignored correctly.
But when I try to map a list TenantRestrictSourceEntity
to a list TenantRestrictSource
with Mapper.Map(tenantRestrictSourceEntities, tenantRestrictSources)
Tenant property is always null
.
How can I ignore that property when mapping a list object?
>(tenantRestrictSourceEntities) ?
– Павел Марченко Jun 26 '18 at 07:57