MSSyncTable Class Reference

Inherits from NSObject
Declared in MSSyncTable.h

Overview

The MSSyncTable class represents a table of a Windows Azure Mobile Service. Items can be inserted, updated, deleted and read from the table. The table can also be queried to retrieve an array of items that meet the given query conditions. All table operations result in a request to the local store and an eventual request to the azure mobile service (see the MSSyncContext for more details).

Properties

  name

The name of this table.

@property (nonatomic, copy, readonly, nonnull) NSString *name

Discussion

The name of this table.

Declared In

MSSyncTable.h

  client

The client associated with this table.

@property (nonatomic, strong, readonly, nonnull) MSClient *client

Discussion

The client associated with this table.

Declared In

MSSyncTable.h

Initializing the MSTable Object

– initWithName:client:

Initializes an MSTable instance with the given name and client.

- (nonnull instancetype)initWithName:(nonnull NSString *)tableName client:(nonnull MSClient *)client

Discussion

Initializes an MSTable instance with the given name and client.

Declared In

MSSyncTable.h

Modifying Items

– insert:completion:

Sends a request to the MSSyncContext’s data source to upsert the given item into the local store. In addition queues a request to send the insert to the mobile service.

- (void)insert:(nonnull NSDictionary *)item completion:(nullable MSSyncItemBlock)completion

Discussion

Sends a request to the MSSyncContext’s data source to upsert the given item into the local store. In addition queues a request to send the insert to the mobile service.

Declared In

MSSyncTable.h

– update:completion:

Sends a request to the MSSyncContext’s data source to upsert the given item into the local store. In addition queues a request to send the update to the mobile service.

- (void)update:(nonnull NSDictionary *)item completion:(nullable MSSyncBlock)completion

Discussion

Sends a request to the MSSyncContext’s data source to upsert the given item into the local store. In addition queues a request to send the update to the mobile service.

Declared In

MSSyncTable.h

– delete:completion:

Sends a request to the MSSyncContext’s data source to delete the given item in the local store. In addition queues a request to send the delete to the mobile service.

- (void)delete:(nonnull NSDictionary *)item completion:(nullable MSSyncBlock)completion

Discussion

Sends a request to the MSSyncContext’s data source to delete the given item in the local store. In addition queues a request to send the delete to the mobile service.

Declared In

MSSyncTable.h

Retreiving Local Items

– readWithId:completion:

Sends a request to the Windows Azure Mobile Service to return the item with the given id from the table.

- (void)readWithId:(nonnull NSString *)itemId completion:(nullable MSItemBlock)completion

Discussion

Sends a request to the Windows Azure Mobile Service to return the item with the given id from the table.

Declared In

MSSyncTable.h

– readWithCompletion:

Sends a request to the Windows Azure Mobile Service to return all items from the table. The Windows Azure Mobile Service will apply a default limit to the number of items returned.

- (void)readWithCompletion:(nullable MSReadQueryBlock)completion

Discussion

Sends a request to the Windows Azure Mobile Service to return all items from the table. The Windows Azure Mobile Service will apply a default limit to the number of items returned.

Declared In

MSSyncTable.h

– readWithPredicate:completion:

Sends a request to the Windows Azure Mobile Service to return all items from the table that meet the conditions of the given predicate.

- (void)readWithPredicate:(nullable NSPredicate *)predicate completion:(nullable MSReadQueryBlock)completion

Discussion

Sends a request to the Windows Azure Mobile Service to return all items from the table that meet the conditions of the given predicate.

Declared In

MSSyncTable.h

– query

Returns an MSQuery instance associated with the table that can be configured and then executed to retrieve items from the table. An MSQuery instance provides more flexibilty when querying a table than the table read* methods.

- (nonnull MSQuery *)query

Discussion

Returns an MSQuery instance associated with the table that can be configured and then executed to retrieve items from the table. An MSQuery instance provides more flexibilty when querying a table than the table read* methods.

Declared In

MSSyncTable.h

– queryWithPredicate:

Returns an MSQuery instance associated with the table that uses the given predicate. An MSQuery instance provides more flexibilty when querying a table than the table read* methods.

- (nonnull MSQuery *)queryWithPredicate:(nullable NSPredicate *)predicate

Discussion

Returns an MSQuery instance associated with the table that uses the given predicate. An MSQuery instance provides more flexibilty when querying a table than the table read* methods.

Declared In

MSSyncTable.h

Managing local storage

– pullWithQuery:queryId:completion:

Initiates a request to go to the server and get a set of records matching the specified MSQuery object. Before a pull is allowed to run, one operation to send all pending requests on the specified table will be sent to the server. If a pending request for this table fails, the pull will be cancelled

- (nullable NSOperation *)pullWithQuery:(nullable MSQuery *)query queryId:(nullable NSString *)queryId completion:(nullable MSSyncBlock)completion

Discussion

Initiates a request to go to the server and get a set of records matching the specified MSQuery object. Before a pull is allowed to run, one operation to send all pending requests on the specified table will be sent to the server. If a pending request for this table fails, the pull will be cancelled

Declared In

MSSyncTable.h

– pullWithQuery:queryId:settings:completion:

Initiates a request to go to the server and get a set of records matching the specified MSQuery object. Before a pull is allowed to run, one operation to send all pending requests on the specified table will be sent to the server. If a pending request for this table fails, the pull will be cancelled

- (nullable NSOperation *)pullWithQuery:(nullable MSQuery *)query queryId:(nullable NSString *)queryId settings:(nullable MSPullSettings *)pullSettings completion:(nullable MSSyncBlock)completion

Discussion

Initiates a request to go to the server and get a set of records matching the specified MSQuery object. Before a pull is allowed to run, one operation to send all pending requests on the specified table will be sent to the server. If a pending request for this table fails, the pull will be cancelled

Declared In

MSSyncTable.h

– purgeWithQuery:completion:

Removes all records in the local cache that match the results of the specified query. If query is nil, all records in the local table will be removed. Before local data is removed, a check will be made for pending operations on this table. If any are found the purge will be cancelled and an error returned.

- (nonnull NSOperation *)purgeWithQuery:(nullable MSQuery *)query completion:(nullable MSSyncBlock)completion

Discussion

Removes all records in the local cache that match the results of the specified query. If query is nil, all records in the local table will be removed. Before local data is removed, a check will be made for pending operations on this table. If any are found the purge will be cancelled and an error returned.

Declared In

MSSyncTable.h

– forcePurgeWithCompletion:

Purges all data, pending operations, operation errors, and metadata for the MSSyncTable from the local cache.

- (nonnull NSOperation *)forcePurgeWithCompletion:(nullable MSSyncBlock)completion

Discussion

Purges all data, pending operations, operation errors, and metadata for the MSSyncTable from the local cache.

Declared In

MSSyncTable.h