CoreData Model Design: Overuse of NSFetchRequest is a symptom of a poorly designed model?

Core Data objects can be obtained using NSFetchRequestor by linking to other objects on the chart. Is it fair to say that in a well-designed model they will contain sufficient relationships (and the resulting properties), so that usage NSFetchRequestswill be minimized?

The counter argument is what exists in iOS NSFetchedRequestController. Presumably, if Apple believes that the relationship and the resulting properties provide satisfactory performance with the existing failure / caching, they would not have created NSFetchedRequestController.

There are times when usage NSFetchRequestoutperforms basic data that can do all the work in SQLite. An example would be collecting aggregate values.

Any thoughts on this? I reviewed the Master Data Programming Guide . There are relevant recommendations in the sections Captured Managed Objects and Master Data, but nothing can strongly suggest a relationship with query queries or vice versa.

+5
source share
3 answers

, NSFetchRequest . , . , :

--------------  1           * ------------
| Department |<------------->>| Employee |
--------------                ------------
| name       |                | name     |
--------------                | age      |
                              | salary   |
                              ------------

, , "department.employees". NSFetchRequest Employee 'department == xxxx'.

, > x, NSFetchRequest "department == xxxxx AND pay > x". , department.employees, , .

, NSFetchRequests "" "". . . NSFetchRequest NSExpressions.

:

NSFetchRequests, , . NSManagedObject Core Data view/view.

, , . NSFetchRequest , Core Data . , .

+2

, , , .

, , , . , , .

0

coredata, , 1, 2 n l, , SQL, , , . Apple , , . , (null, cascade..), . , , . .

One of my applications (Mariette) uses basic data, and the other (billingfiles) uses SQL

0
source

All Articles