Explicit expansion
In some scenarios, such as OData, a generic DTO is returned through an IQueryable controller action. Without explicit instructions, AutoMapper will expand all members in the result. To control which members are expanded during projection, set ExplicitExpansion in the configuration and then pass in the members you want to explicitly expand:
dbContext.Orders.ProjectTo<OrderDto>(configuration,
dest => dest.Customer,
dest => dest.LineItems);
// or string-based
dbContext.Orders.ProjectTo<OrderDto>(configuration,
null,
"Customer",
"LineItems");
// for collections
dbContext.Orders.ProjectTo<OrderDto>(configuration,
null,
dest => dest.LineItems.Select(item => item.Product));
For more information, see the tests.
标签:configuration,dest,Explicit,expansion,AutoMapper,LineItems From: https://www.cnblogs.com/chucklu/p/16615715.html