![]() Stores can be attached at any time after you create the Connect or PersistentStack instance. Both versions can be intermixed if required. In the case of attach, you attach multiple stores at the same location ( url). Note: Both attachPersistentStore(for:) and detach(persistentStore:) have plural equivalents ( attachPersistentStores(for:) and detach(persistentStores:)) that allow you to attach and detach multiple stores at a time. This can be accomplished through the methods attachPersistentStore(for:) and detach(persistentStore:). The user information can be used to decide the proper stores to attach for that user. For instance, you may want to bring a global store online that stores your user tables so you can determine the logged in user. Persistent stores can be attached and detached in steps to facilitate various requirements and use cases. Other than that, they are completely interchangeable as a PersistentStack. This means that the initialization and startup sequence is the same except that GenericConnect has one additional requirement which is to start the instance. ![]() In memory and propagated to the persistentStore indirectly in a background threadĭuring initialization and startup of Coherence you can rely on its default behavior, or you can take complete control over these aspects.īoth GenericConnect and GenericPersistentContainer implement the PersistentStack protocol. That are connected directly to the NSPersistentStoreCoordinator.Ĭhanges made to BackgroundContexts are propagated directly to the persistentStoreĪllowing merge policies to be set and respected. Through a root context to the NSPersistentStoreCoordinator and background contexts The ContextStrategy.Mixed manages a nested (parent/child) viewContexts connected indirectly Propagation of changes to the persistent store are done indirectly in the background through a root context. The ContextStrategy.Nested manages nested (parent/child) contexts (for view and background) connected indirectly through a root context to the NSPersistentStoreCoordinator. Note: The view context will not be kept up to date with this strategy.The ContextStrategy.Independent manages independent contexts (for view and background) connected directly to the NSPersistentStoreCoordinator. Note: The view context will be kept up to date and persisted to the store when a background context is saved.Changes made to BackgroundContexts are propagated directly to the persistentStore allowing merge policies to be set and respected. The ContextStrategy.Direct manages the viewContext and BackgroundContext connected directly to the NSPersistentStoreCoordinator. If one of these strategies doesn't give you what you require for your application, you can also create your own by implementing the ContextStrategyType protocol. Connect currently has 4 built in strategies Direct, DirectIndependent, IndirectNested and Mixed. The ContextStrategy classes encapsulate the layout and behavior of the ManagedObjectContexts of the CoreData stack. To facilitate this,Ĭoherence gives you a choice of strategies used by a PersistentStack instance. In general usage a CoreData stack can be configured in several configurations base on your use case. Connect creates an instance Context Strategy ContainerĬonnect's container is built on top of the Coherence Container which is an implementation of the PersistentStack protocol. All services it offers outside this are built on top of the GenericConnect instance. Coherence takes on the role of a persistent container (implementing the PersistentStack protocol) creating and managing a core data stack for you. Coherence provides a generic concrete implementation of the Connect protocol with the GenericConnect class. Overview ConnectĪt the heart of Coherence are it's resource management services which are expose via the Connect protocol. It provides you with a comprehensive framework for managing low level resources intelligently and efficiently. Coherence helps you build apps that require persistence, offline storage, store and forward and web connectivity. Coherence, the configurable CoreData extension for the Web Service era.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |