I have a model where I am using a discriminator. As I cannot share the original code, here is a mockup
public class Dog {}
public class SomeDog : Dog {}
Now I want my entities to be sorted by the Discriminator
, having SomeDog
first and only after these, having my Dog
entities.
Is there any way to actually sort on my Discriminator
? Or do I have to find a workaround?
Have you tried sort when you read list of context?
Example:
YourContext.Dogs.OrderBy(d => (d is SomeDog) ? 1 : 2)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With