I have this code to get all Meal from the database but considering optimization, i want to only get the entities needed, instead of returning all.
public async Task<IEnumerable<Meal>> GetAllMeal()
{
return await _dbSet.Include(x => x.MealPrices).ToListAsync();
}
The above code will fetch all entities from the database including the ones i don't need. Is there a way to map my dto at the point of fetching the data from db