1 回答
TA贡献1784条经验 获得超9个赞
按照提示,我重写了一切
询问:
var query = filteredTickets // IQueryable<Ticket>
.Include(ten => ten.Tenant)
.ThenInclude(ed => ed.Edition)
.Include(p => p.Product)
.Include(pv => pv.ProductVersion)
.Include(tt => tt.TicketType)
.Include(tp => tp.TicketPriority)
.Include(ts => ts.TicketState)
.Include(lu => lu.LinkedUsers)
.ThenInclude(tlt => tlt.TicketLinkType)
.Include(lu => lu.LinkedUsers)
.ThenInclude(u => u.User)
.ProjectTo<GetTicketForView>();
映射:
configuration.CreateMap<Ticket, TicketDto>();
configuration.CreateMap<Tenant, TenantShortInfoDto>();
configuration.CreateMap<TicketState, TicketStateTableDto>();
configuration.CreateMap<TicketLinkedUser, TicketLinkedUserDto>();
configuration.CreateMap<Ticket, GetTicketForView>()
.ForMember(dest => dest.Ticket, conf => conf.MapFrom(src => src)
);
如果我将来想切换到 nhibernate,不确定我是否在这里失去了一些灵活性,但它比以前好得多。
- 1 回答
- 0 关注
- 140 浏览
添加回答
举报