Replies: 2 comments
-
Thanks for reporting this. It doesn't seem optimal, and we should definitely improve it. Could you please describe how you expect the generated code to look like? .Select(x => x.ServiceFaults.OrderByDescending(y => y.FaultedAt).FirstOrDefault(y => y.ClearedAt != null))
.Select(x => new ApiServiceExtended
{
LastFault = x == null
? null
: new ApiServiceFault
{
FaultedAt = x.FaultedAt,
ClearedAt = x.ClearedAt,
Reason = x.Reason,
...
}
}) Btw, I think the generated code you provided and my sample should yield the same SQL generated by EF Core. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Closing as no further response was received, I'll reopen as soon as more information is provided. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The following mapping:
...creates a Queryable expression that looks like:
...which is obviously inefficient. I'm moving from AutoMapper, which uses a temporary variable to handle the same scenario.
Is there a better way to handle this in Mapperly? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions