Closed MoMack20 closed 1 year ago
I think I figured out where the problem is coming from. Elsewhere in our code we always ProjectToType from the EF model to a DTO. In this scenario its being ProjectToType from the EF model to the EF model. That seems to be what's causing the problem
I'm not sure how to interpret your last comment -- is this an issue in Mapster, or an issue in your code?
On a sidenote -- it's usually a good idea to materialize the query before executing ProjectToType(). Mapster can run into issues with losing its context when using ProjectToType with async queries.
I don't think it is an issue with Mapster as much as an odd behavior with using ProjectToType() before materializing the query and mapping to a class that is also configured with EF.
We are using ProjectToType to load all data from a table that has maybe 8-10 rows. The table has a relation to our Orders table which has millions of rows. Somehow loading the OrderType table with 8-10 rows forces the Orders table to load which quickly blows out the memory for the application.
Here is the OrderType table setup:
Here is the Order table setup:
Here is the EF Query to load OrderTypes:
Here is the resulting heap diagnostic 4 minutes after loading all OrderTypes: