I have following model:
A
1
|
*
B
^ ^
| |
B1 B2
where B is an abstract superclass of B1 and B2. I now have a PSQuery like:
var data = es.PSQuery<A>().Where(..).SelectMany(x => x.Bs).ToList();
The generated SQL looks like following:
SELECT ALIAS.ID FROM B ALIAS WHERE ....
Then MDriven gets all discriminators in chunks to determine the type of the objects, so these can be quite some SQLs:
SELECT ALIAS.ID, ALIAS.DISCRIMINATOR FROM B ALIAS WHERE ID in (?, ? ....)
Now MDriven knows the types and can load the data. This process all in all takes much longer than a handmade SQL. So my questions are:
First : If you need a result set for multiple classes (an abstract result set) your load times would benefit from having the sub classes parent mapped (Subclasses written in one - parent - table)
To get the generated SQL from a PSQuery:
var sqltext = this.EcoSpace.OclPs.ReturnPlatformQuery(null, vars, model.OclPS);
You can have Parent, Child or Own mapping of Subclasses. When you have "Own" you get 1 table per subclass + 1 table per superclass. In this scenario we first reduce to the specific ids based on discriminator - then fetch the data per subclass