Thank you very much aaroon, it works.
Now, how to add multiple attributes?
In reality, the repository gives bad results. here an example
public class Parent: FullAuditedEntity
{
[Required]
public virtual string Name { get; set; }
public virtual ICollection<Child> Children{ get; set; }
}
public class Child: FullAuditedEntity
{
[ForeignKey("ParentId")]
public virtual Parent Parent{ get; set; }
[Required]
public virtual int ParentId { get; set; }
public virtual string Name { get; set; }
}
[AutoMapFrom(typeof(Parent))]
public classChildDto : FullAuditedEntityDto
{
public string Name { get; set; }
public int ParentId { get; set; }
public string ParentName { get; set; }
}
public class ChildAppService : MyAppServiceBase, IChildAppService
{
private readonly IRepository<Child> _childRepository;
public ChildAppService(IRepository<Child> childRepository)
{
_childRepository = childRepository;
}
public async Task<ListResultDto<ParentDto>> GetChildren()
{
var children= await _childRepository.GetAllListAsync();
return new ListResultDto<ChildDto>(ObjectMapper.Map<List<ChildDto>>(children));
}
}
in the children list, the children[i].Parent is always null
Hello in Asp.net Zero Core & Angulare v4.5.1 .net Core 2.0 solution, AutoMapper Flattering dont work.
thanks in advance.