C#C
C#2y ago
35 replies
nox7

EF Core - Joining Two Similar Tables Before In-Memory-Buffering Into One DTO

Because of how Stripe's API stores two specific objects (Subscription and SubscriptionSchedule), I have to have two EF Core models for those. However, they essentially have almost all the same columns.

I want to present these as a single data set to my clients - orderable and sortable as if they were just one data set.

How can I query both of those models in my DbContext and then combine them into a single Queryable result set as a SubscriptionDto - without triggering the in-memory buffering. I want to be able to order them/paginate them later on as a single result set so I don't want them to be buffered into memory until they are combined into a single Dto.
Was this page helpful?