Core Data(二)

Core Data Features

  • Change tracking and undo support.

    Core Data provides built-in management of undo and redo beyond basic text editing.

  • Relationship maintenance.

    Core Data manages change propagation, including maintaining the consistency of relationships among objects.

  • Futures (faulting).

    Core Data can reduce the memory overhead of your program by lazily loading objects. It also supports partially materialized futures, and copy-on-write data sharing.

  • Automatic validation of property values.

    Core Data’s managed objects extend the standard key-value coding validation methods that ensure that individual values lie within acceptable ranges so that combinations of values make sense.

  • Schema migration.

    Dealing with a change to your application’s schema can be difficult, in terms of both development effort and runtime resources. Core Data’s schema migration tools simplify the task of coping with schema changes, and in some cases allow you to perform extremely efficient in-place schema migration.

  • Optional integration with the application’s controller layer to support user interface synchronization.

    Core Data provides the NSFetchedResultsController object on iOS, and integrates with Cocoa Bindings on OS X.

  • Full, automatic, support for key-value coding and key-value observing.

    In addition to synthesizing key-value coding and key-value observing compliant accessor methods for attributes, Core Data synthesizes the appropriate collection accessors for to-many relationships.

  • Grouping, filtering, and organizing data in memory and in the user interface.

  • Automatic support for storing objects in external data repositories.

  • Sophisticated query compilation.

    Instead of writing SQL, you can create complex queries by associating an NSPredicate object with a fetch request. NSPredicate provides support for basic functions, correlated subqueries, and other advanced SQL. With Core Data, it also supports proper Unicode, locale-aware searching, sorting, and regular expressions.

  • Merge policies.

    Core Data provides built in version tracking and optimistic locking to support automatic multi-writer conflict resolution

    Undo Management

    NSManagedObjectContext *moc = ...;
    [moc processPendingChanges];  // flush operations for which you want undos
    [[moc undoManager] disableUndoRegistration];
    // make changes for which undo operations are not to be recorded
    [moc processPendingChanges];  // flush operations for which you do not want undos
    [[moc undoManager] enableUndoRegistration];

    Ensuring Data Is Up-to-Date

    To refresh a managed object's property values, you use the managed object context method refreshObject:mergeChanges:











评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值