Database Manager are one Facade around Core Data classes that facilitate the main operations around the Core Data Framework. More...
#import <JPDBManager.h>
Properties | |
NSManagedObjectModel * | managedObjectModel |
Core Data Managed Object Model. | |
NSManagedObjectContext * | managedObjectContext |
Core Data Managed Object Context. | |
NSPersistentStoreCoordinator * | persistentStoreCoordinator |
Core Data Persistent Store Coordinator. | |
NSString * | loadedModelName |
Current full path of Loaded Model. | |
BOOL | automaticallyCommit |
Configure the manager to automatically commit every operation. | |
Init Methods | |
(id) | + init |
Init and Alloc the Database Manager Class. | |
(id) | + initAndStartCoreData |
Init and Alloc the Database Manager Class. | |
Start and Stop Methods | |
(id) | - startCoreData |
Start Core Data elements (managedObjectModel, managedObjectContext, persistentStoreCoordinator) and will merge ALL models in your bundle. | |
(id) | - startCoreDataWithModel: |
Start Core Data elements (managedObjectModel, managedObjectContext, persistentStoreCoordinator). | |
(void) | - closeCoreData |
Close Core Data Databases, commit pendent updates and release resources. | |
Get Info Methods | |
(BOOL) | - existEntity: |
Test if specified Entity exist on the model. | |
(BOOL) | - existAttribute:inEntity: |
Test if specified Attribute exist on specified Entity. | |
(JPDBManagerAction *) | - getDatabaseAction |
Helper method to retrieve an Database Action object. | |
Write Data Methods | |
(void) | - commit |
Commit al pendent operations to the persistent store. |
Database Manager are one Facade around Core Data classes that facilitate the main operations around the Core Data Framework.
See the Basic Uses to learn the basic concepts about this class. Also consult Handling Errors and Performing Queries.
+ (id) init |
Init and Alloc the Database Manager Class.
+ (id) initAndStartCoreData |
Init and Alloc the Database Manager Class.
Automatically Start all Core Data Engine.
- (id) startCoreData |
Start Core Data elements (managedObjectModel, managedObjectContext, persistentStoreCoordinator) and will merge ALL models in your bundle.
Database Manager initiate the Managed Object Context and set the Merge Policy to NSMergeByPropertyObjectTrumpMergePolicy
in order to merge conflicts between the persistent store’s version of the object and the current in-memory version, giving priority to in-memory changes.
Use startCoreDataWithModel: if you need to use an specific model or model version.
An | JPDBManagerStartException exception is raised if some error ocurrs. See Handling Errors for more informations. |
- (id) startCoreDataWithModel: | (NSString*) | modelName |
Start Core Data elements (managedObjectModel, managedObjectContext, persistentStoreCoordinator).
Database Manager initiate the Managed Object Context and set the Merge Policy to NSMergeByPropertyObjectTrumpMergePolicy
in order to merge conflicts between the persistent store’s version of the object and the current in-memory version, giving priority to in-memory changes.
You should inform the Model that you want to use with name and extension.
modelName | Specific Model Name including the extension. Usually the model has the extension .momd on the bundle. |
An | JPDBManagerStartException exception is raised if some error ocurrs. See Handling Errors for more informations. |
- (BOOL) existEntity: | (NSString*) | anEntityName |
Test if specified Entity exist on the model.
anEntityName | The Entity Name. |
- (BOOL) existAttribute: | (NSString*) | anAttributeName | |
inEntity: | (NSString*) | anEntityName | |
Test if specified Attribute exist on specified Entity.
anAttributeName | The Attribute name. |
anEntityName | The Entity name. |
- (JPDBManagerAction *) getDatabaseAction |
Helper method to retrieve an Database Action object.
The manager is automatically associcated to this object.
- (NSString *) loadedModelName [read, assign] |
Current full path of Loaded Model.
If you don't specify one model manually using startCoreDataWithModel: this value will be nil
.
- (BOOL) automaticallyCommit [read, write, assign] |
Configure the manager to automatically commit every operation.
Default value is NO. See Basic Uses for more information.