Hierarchy implementation and fixes#215
Conversation
|
I have some doubts about I would replace it with a cast like this So I would generate two expressions for each member in a hierarchy: one for the public invocations, and one for invocations from derived classes to avoid loops. |
|
Also closes #213 I have rewritten I am now generating 2 expressions for hierarchies: one "complete" which has all the typecasts and derived classes invocations, and one "base" which is used when replacing The "base" expressions currently do not have an assembly registry generated like regular expressions. |
Closes #74 and #213
I have added support for hierarchies where overwritten members are all added in the parent body with type casts, this is to match the runtime behaviour for generated expressions.
I have also allowed members tagged with [Projectable] to not have any body at all (abstract method/property) if they have at least one implemented member in derived classes.
I have added some tests, maybe not 100% of cases are covered, currently I'm not sure if any sub-hierarchies would be better flattened or not, eg:
A hierarchy like this:
will generate a final Expression like this (the nested B1 expression gets replaced later):
And I'm not sure if it would be better to generate a flat expression like this instead (by associating the condition for B1 to the last else), or if this is something already handled by EF Core:
I am open to any coding-style changes which might be required, also if everything seems good so far I could edit the docs to reflect the new changes.