核心数据根据来自其他实体的ID获取

时间:2014-06-20 07:48:19

标签: entity-framework core-data reference

我在Core数据中有两个实体。

首先如下: - 构建实体.h文件

@interface Permits : NSManagedObject

@property (nonatomic, retain) NSString * notes;
@property (nonatomic, retain) NSString * status;
@property (nonatomic, retain) NSString * sec;
@property (nonatomic, retain) NSString * phoneNo;
@property (nonatomic, retain) NSString * address;
@property (nonatomic, retain) NSString * submitDate;
@property (nonatomic, retain) NSString * inputDate;
@property (nonatomic, retain) NSString * projectName;
@property (nonatomic, retain) NSString * permitNumber;
@property (nonatomic, retain) NSString * buildingDep;

@end

收藏夹构建实体.h文件

@interface FavPermits : NSManagedObject

@property (nonatomic, retain) NSString * permitNum;

@end

用户可以将Building添加到他们的收藏夹部分。现在,我想根据在收藏夹构建实体中可用的permitNum从建筑物中获取数据。

SQL查询如下: -

Select * from Building as b, favBuilding as fb where b.permitNumber = fb.permitNum 

0 个答案:

没有答案