Thanks @exlnt & @ismcagdas !
I was able to retrieve the UserName simply by adding CreatorUserUserName to my DTO.
If this object is mapped(?), where is it inherited from? I am trying to understand how the object CreatorUser is created?
Thanks!
I tried something like this. Which populates the query correctly, but then I get mapping errors with my listDto.
var query = from Widget in _WidgetRepository
.GetAll()
.Include(p => p.CreatorUser)
.AsQueryable()
select new
{
Id = Widget.Id,
Priority = Widget.Priority,
UserName = Widget.CreatorUser.UserName,
CreationTime = Widget.CreationTime
};
[AutoMap(typeof(Widget))]
public class WidgetListDto
{
public Guid Id { get; set; }
public int Priority { get; set; }
public DateTime CreationTime { get; set; }
[NotMapped]
public string UserName { get; set; }
}