0
votes

I have an abstract parent entity Datapoint with a number of attributes, and 3 child entities BinaryPoint, FloatPoint, and ScalePoint. Each child should have a value attribute, but of a different type (bool, float, and int respectively).

It seems like bad design to do anything other than make it an inherited attribute, but I can't find a way to do this. Is there any way to make the attribute generic in the parent entity but not in its children?

Thanks in advance.

1
What do you mean by 'generic' attribute? If I understood you well you want a parent 'Datapoint' to have and 'id' attribute called 'value', but 'BinaryPoint' must define it as a binary value, the 'ScalePoint' as a scalar and the 'FloatPoint' as a float, right?Gianluca Tranchedone

1 Answers

0
votes

There is no way to do what you want to do in the Core Data Model Editor AFASIK. You'll need to pick a type of attribute, e.g. Binary Data, and handle the transformation from NSData to the actual value or viceversa yourself in code.