0
votes

I have something like this:

public class Person {
    string Name;
}

public class Customer : Person {
    List<Order> orders;
}   

public class MyReference {
    Person aPerson;
}

public class Me {
    MyReference myRef;
}       

Now in my Metamodel I have specified a baseType for Customer. And I think my metamodel is right. The only problem is, that when I want to execute a query like the following:

breeze.EntityQuery.from('Me').expand('myRef, myRef.aPerson, myRef.aPerson.orders')

I get an error, that "orders" is not allowed on the EntityType "Person". Of course as it's the base-class. I would like it to be polymorphic and if the Person is really of Type "Customer" it should expand orders and if not, well then it can be empty or not defined or not even existent on the object.

Is this somehow possible? Would I need some kind of "toType" to cast inside the Query?

1

1 Answers

0
votes

The base class, Person, does not have an Orders property. Therefore, .NET (EF) on the server won't let you ask for Person.Orders. That's not how polymorphism works in EF and there isn't anything Breeze can do to change that.

You'll need a different approach I'm afraid.

FWIW, that isn't how polymorphism works in Breeze either.