Sort on discriminator

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)
链接地址: http://www.djcxy.com/p/14594.html

上一篇: Rectangle类的函数getX(),getY()等以双精度返回

下一篇: 排序鉴别器