这是一个愚蠢的问题,但我认真找不到答案......
我有一个从实体Events到Discounts的一对多关系,我在Xcode中设置了这样的关系:
我需要这种关系是相反的,所以我可以检查Discount来自哪个Event ,但在XCode中,我只能选择“不反向”。 我怎样才能将这种关系设定为逆向?
如果你必须以编程方式进行,首先,认真对待? 它不能从XCode完成? 其次,我该怎么做呢? 这应该在哪里完成?
谢谢
This is a silly question, but I seriously didn't find an answer...
I have a one-to-many relationship from the Entity Events to Discounts and I set a relationship like this in Xcode:
I need that relationship to be inverse, so I can check which Event a Discount is from, but in XCode I can only choose "No Inverse." How can I set that relationship to be inverse?!
If you have to do it programatically, first, seriously? It can't be done from XCode? Secondly, how can I do it? And where should this be done?
Thanks
最满意答案
为了能够设置反向关系,您需要先在目标实体中创建它。
因此,在折扣实体中创建您想要用作反向(例如event )的event ,那么您将能够选择它作为您的toDiscounts关系的反向
To be able to set inverse relationship you need to create it first in destination entity.
So in Discounts entity create relationship to Event that you want to use as reverse (e.g. event), then you will be able to choose it as reverse for your toDiscounts relationship
更多推荐
发布评论