Discriminator Sort - EF

I have a model where I use the discriminator. Since I can not share the source code, here is the layout

public class Dog {} public class SomeDog : Dog {} 

Now I want my objects to be sorted using Discriminator , having SomeDog first and only after that, having my Dog objects.

Is there a way to actually sort my Discriminator ? Or do I need to find a workaround?

+7
source share
1 answer

Have you tried sorting when you read the context list?

Example:

 YourContext.Dogs.OrderBy(d => (d is SomeDog) ? 1 : 2) 
+3
source

All Articles