#2 ✓resolved
mklaurence (at gmail)

createOrUpdateWithDictionary should template/reuse byId fetch requests for efficiency

Reported by mklaurence (at gmail) | March 6th, 2010 @ 04:49 PM | in Beta release (0.9)

Pre-created "byId" templates are currently searched for, but since we've added automatic templating to FetchRequest generation (see fetchRequest: method), we can just use that to deal with templates automatically.

NSFetchRequest* fetch = [[[self coreManager] managedObjectModel] 
    fetchRequestFromTemplateWithName:[NSString stringWithFormat:@"%@ById", self] 
        substitutionVariables:[NSDictionary dictionaryWithObject:resourceId forKey:@"id"]
    if (fetch == nil) {
        fetch = [self fetchRequestWithSort:nil andPredicate:
            [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"%@ = %@", [self localIdField], resourceId]]];
    [fetch setFetchLimit:1];

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Local & remote resource management library for Objective-C using Core Data with Rails-like syntax. WARNING: The API is currently under heavy development and will undoubtedly change.

Shared Ticket Bins

People watching this ticket