Nu Class Reference

NuCoreDataSession

Superclass: NSObject
Declared in: nu/coredata.nu

Instances of this class can be used to manage CoreData sessions. They encapsulate the three major elements of a CoreData session: the managed object model, the persistent store coordinator, and the managed object context. While at times it may be useful to treat these three elements separately, in many situations, that needlessly complicates the use of CoreData. With the methods of this class and the accompanying extensions to NSManagedObject, it is very easy to use CoreData from Nu.

Methods

- (id) objectWithEntity: (id) entityName
identifier: (id) identifier
Get an object with a specified entity and identifier. This method allows an object to be associated with a short integer identifier. Identifiers are represented as NSStrings. It works by extracting the identifier from the object's URIRepresentation. If the implementation of URIRepresentation changes, this will break.

in nu/coredata.nu

- (id) entityWithName: (id) name
Get an entity with a specified name.

in nu/coredata.nu

- (id) entities
Get an array of entities in the managed object model.

in nu/coredata.nu

- (id) objectsWithEntity: (id) entityName
propertyValues: (id) pairs
sortDescriptors: (id) sortDescriptors
Get all objects of a specified entity with the property values in a specified list, sorted.

in nu/coredata.nu

- (id) objectsWithEntity: (id) entityName
propertyValues: (id) pairs
Get all objects of a specified entity with the property values in a specified list.

in nu/coredata.nu

- (id) objectsWithEntity: (id) entityName
property: (id) property
value: (id) value
Get all objects of a specified entity with a given property value.

in nu/coredata.nu

- (id) anyObjectWithEntity: (id) entityName
Get any object with a specified entity.

in nu/coredata.nu

- (id) objectsWithEntity: (id) entityName
Get all objects of a specified entity.

in nu/coredata.nu

- (id) objects
Get all objects in the session's context.

in nu/coredata.nu

- (id) findOrCreateObjectWithEntity: (id) entityName
propertyValues: (id) pairs
Find or create an object with the property values in a specified list.

in nu/coredata.nu

- (id) createObjectWithEntity: (id) entityName
Create an object for a specified entity.

in nu/coredata.nu

- (id) managedObjectContext
Get the managed object context, initializing it if necessary.

in nu/coredata.nu

- (id) persistentStoreCoordinator
Get the persistent store coordinator, initializing it if necessary.

in nu/coredata.nu

- (id) managedObjectModel
Get the managed object model, initializing it if necessary.

in nu/coredata.nu

- (id) save
Save the session's managed object context.

in nu/coredata.nu

- (id) initWithName: (id) name
mom: (id) momFile
xmlStore: (id) storeFile
Create a session with a specified model and XML store file.

in nu/coredata.nu

- (id) initWithName: (id) name
mom: (id) momFile
sqliteStore: (id) storeFile
Create a session with a specified model and SQLite store file.

in nu/coredata.nu