Skip to content
This repository has been archived by the owner on Jun 13, 2020. It is now read-only.

Using GVRDataManagerConfiguration

Sebastian Owodziń edited this page Mar 28, 2015 · 1 revision

Using GVRDataManagerConfiguration

Using pre-defined configurations

// default configuration (single SQLite store & merged models from main bundle)
GVRDataManagerConfiguration *configuration = [GVRDataManagerConfiguration defaultConfiguration];
GVRDataManager *dataManager = [[GVRDataManager alloc] initWithConfiguration:configuration];

// single SQLite store configuration (single SQLite store & merged models from main bundle)
GVRDataManagerConfiguration *configuration = [GVRDataManagerConfiguration singleSQLiteStoreConfiguration];
GVRDataManager *dataManager = [[GVRDataManager alloc] initWithConfiguration:configuration];

// single binary store configuration (single binary store & merged models from main bundle)
GVRDataManagerConfiguration *configuration = [GVRDataManagerConfiguration singleBinaryStoreConfiguration];
GVRDataManager *dataManager = [[GVRDataManager alloc] initWithConfiguration:configuration];

// single in-memory store configuration (single in-memory store & merged models from main bundle)
GVRDataManagerConfiguration *configuration = [GVRDataManagerConfiguration singleInMemoryStoreConfiguration];
GVRDataManager *dataManager = [[GVRDataManager alloc] initWithConfiguration:configuration];

Using self-defined configuration

GVRDataManagerConfiguration *configuration = [GVRDataManagerConfiguration defaultConfiguration];

// bundles array to look up models
configuration.modelBundles = @[ ... ];
// models array to combine
configuration.models = @[ ... ];
// persistent stores array to use
configuration.persistentStores = @[
  @{
    GVRDataManagerConfiguration_PersistentStoreURLKey: [[GVRDataManager applicationDocumentsDirectory] URLByAppendingPathComponent:@"gloverPersistedEntities.sqlite"],
    GVRDataManagerConfiguration_PersistentStoreTypeKey: NSSQLiteStoreType,
    GVRDataManagerConfiguration_PersistentStoreConfigurationKey: @"PersistedEntities"
  },
  @{
    GVRDataManagerConfiguration_PersistentStoreTypeKey: NSInMemoryStoreType,
    GVRDataManagerConfiguration_PersistentStoreConfigurationKey: @"InMemoryEntities"
  }
]

GVRDataManager *dataManager = [[GVRDataManager alloc] initWithConfiguration:configuration];