Class Subscription
A set of helper methods exposing query-based sync related functionality over collections.
Inherited Members
Namespace: Realms.Sync
Assembly: Realm.Sync.dll
Syntax
public static class Subscription
Methods
| Improve this Doc View SourceSubscribe<T>(IQueryable<T>, String)
For Realms using query-based synchronization, fetches and synchronizes the objects that match the query.
Declaration
public static Subscription<T> Subscribe<T>(this IQueryable<T> query, string name = null)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | query | A query, obtained by calling All<T>() with or without additional filtering applied. |
String | name | The name of this query that can be used to unsubscribe from. |
Returns
Type | Description |
---|---|
Subscription<T> | A Subscription<T> instance that contains information and methods for monitoring the state of the subscription. |
Type Parameters
Name | Description |
---|---|
T | The type of the objects making up the query. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ArgumentException | Thrown if the |
UnsubscribeAsync(Realm, String)
Cancel a named subscription that was created by calling Subscribe<T>(IQueryable<T>, String).
Removing a subscription will delete all objects from the local Realm that were matched only by that subscription and not any remaining subscriptions. The deletion is performed by the server, and so has no immediate impact on the contents of the local Realm. If the device is currently offline, the removal will not be processed until the device returns online.
Declaration
public static Task UnsubscribeAsync(this Realm realm, string subscriptionName)
Parameters
Type | Name | Description |
---|---|---|
Realm | realm | The Realm where this subscription was added. |
String | subscriptionName | The name of the subscription to remove. |
Returns
Type | Description |
---|---|
Task | An awaitable task, that indicates that the subscription has been removed locally. |
UnsubscribeAsync<T>(Subscription<T>)
Cancel a subscription that was created by calling Subscribe<T>(IQueryable<T>, String).
Removing a subscription will delete all objects from the local Realm that were matched only by that subscription and not any remaining subscriptions. The deletion is performed by the server, and so has no immediate impact on the contents of the local Realm. If the device is currently offline, the removal will not be processed until the device returns online.
Declaration
public static Task UnsubscribeAsync<T>(this Subscription<T> subscription)
Parameters
Type | Name | Description |
---|---|---|
Subscription<T> | subscription | The subscription to cancel. |
Returns
Type | Description |
---|---|
Task | An awaitable task, that indicates that the subscription has been removed locally. |
Type Parameters
Name | Description |
---|---|
T | The type of the objects that make up the subscription query. |