Merge branch 'charlesmchen/modelConnection' into hotfix/2.13.3.0

pull/1/head
Matthew Chen 8 years ago
commit e24f18320d

@ -80,17 +80,24 @@
+ (YapDatabaseConnection *)dbReadConnection + (YapDatabaseConnection *)dbReadConnection
{ {
// We use TSStorageManager's dbReadWriteConnection (not its dbReadConnection) // We use TSYapDatabaseObject's dbReadWriteConnection (not TSStorageManager's
// for consistency, since we tend to [TSYapDatabaseObject save] and want to // dbReadConnection) for consistency, since we tend to [TSYapDatabaseObject
// write to the same connection we read from. To get true consistency, we'd // save] and want to write to the same connection we read from. To get true
// want to update entities by reading & writing from within the same // consistency, we'd want to update entities by reading & writing from within
// transaction, but that'll be a big refactor. // the same transaction, but that'll be a big refactor.
return [self storageManager].dbReadWriteConnection;
return self.dbReadWriteConnection;
} }
+ (YapDatabaseConnection *)dbReadWriteConnection + (YapDatabaseConnection *)dbReadWriteConnection
{ {
return [self storageManager].dbReadWriteConnection; // Use a dedicated connection for model reads & writes.
static YapDatabaseConnection *dbReadWriteConnection = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
dbReadWriteConnection = [self storageManager].newDatabaseConnection;
});
return dbReadWriteConnection;
} }
+ (TSStorageManager *)storageManager + (TSStorageManager *)storageManager

Loading…
Cancel
Save