Developer

Create Operations

Create an SODataEntity using the scheduleCreateEntity:collectionPath:delegate:options: method on the SODataStore.

The scheduleCreateEntity takes an SODataEntity and the collectionName as the parameter. An SODataEntity is created locally and then passed along as a parameter. The SODataPropMode can be combined using the binary operator.
  1. Create a local SODataEntity and set values for the properties.
  2. Set the SODataPropMode. Options are All, Keys, Mandatory, Optional.
  3. Call the scheduleCreateEntity method on the SODataStore. Get the response in the proper delegate method.
    id<SODataEntity> entity = [[SODataEntityDefault alloc] initWithType:@"EntityType"];
    NSError* err = nil;
    [self.store allocatePropertiesOfEntity:entity mode:SODataPropModeAll error:&err];
    id<SODataProperty> prop = [entity.properties objectForKey:@"PropertyName"];
    prop.value = @"Value";
    prop = [entity.properties objectForKey:@" PropertyName 2"];
    prop.value = @"Value2";
    [self.store allocateNavigationProperties:entity error:&err];
    self.currentRequestExecution = [self.store scheduleCreateEntity:entity collectionPath:@"CollectionPath" delegate:self options:nil];