bmoeskau wrote:
Overriding fields in a subtype is what inheritance should do, isnt it?
Well, of course. BUT... if I was designing these objects in code manually, the compiler would have told me that I had duplicated a property name within the subclass and forced me to explicitly override the base method or change the name. It would not have simply aliased the base property on me behind the scenes without a warning.
Yes, but the llblgen pro designer isn't C#
Also, I see a difference between true OO class inheritance vs. relational DB table inheritance. In the former, you are generally changing the behavior of an object, whereas in the DB you are simply "overriding" the storage location of a value. Why would you typically do that? If the column has the exact same name as the base table, why not just defer storage to the base table? To change the data type or length? It's OK that you CAN do it, but I don't see that it's such a compelling pattern that LLBL should assume that's what was intended (as in my case, it was accidental).
The thing is that if a subtype has the same name for the PK field as the supertype, it has to override that field, as there's just one PK field, right? So this is also true for other fields. All fields are always stored in the base class, so there aren't fields stored in subtypes and fields stored in supertypes, it's ONE fields object.
It's also not solveable: I also could have generated uncompilable code, which would make you wonder why the code didn't compile. Not everyone then makes the link back to the designer for the duplicate name.
Inheritance of entities isn't something you should always do or do without thinking it through: if you do it, you design the tables for the inheritance and that automatically leads to proper names and placement of attributes in the right entities.
And again, the fact that it does that is one thing, but the bigger issue is that once I realized my mistake, there did not seem to be a way through the designer to "undo" it. After removing the duplicate column, it still generated with the incorrectly-aliased name and there was nowhere to un-alias it. I ended up having to do a replace all in VS to "fix" the FieldIndexes. That's the main thing that seemed like a bug to me, unless I'm missing something.
You could simply have renamed the field of the subtype in the designer.
The fieldindexes are created this way, because all fields are stored in a single fieldobject, and if you cast the object to the supertype, you would index into a different field than if you would cast the object to the subtype.