Class Subscription<T>
A class that represents a subscription to a set of objects in a synced Realm.
When query-based sync is enabled for a synced Realm, the only objects that the server synchronizes to the
client are those that match a sync subscription registered by that client. A subscription consists of
of a query (represented by an IQueryable{T}
) and an optional name.
The state of the subscription can be observed by subscribing to the PropertyChanged event handler.
Subscriptions are created by calling Subscribe<T>(IQueryable<T>, String).
Implements
Inherited Members
Namespace: Realms.Sync
Assembly: Realm.Sync.dll
Syntax
public class Subscription<T> : INotifyPropertyChanged, ISubscription
Type Parameters
Name | Description |
---|---|
T | The type of the objects that make up the subscription query. |
Properties
| Improve this Doc View SourceError
Gets a value indicating what error (if any) has occurred while processing the subscription.
If the State is not Error, this will be null
.
Declaration
public Exception Error { get; }
Property Value
Type | Description |
---|---|
Exception | An instance of Exception if an error has occurred; |
Results
Gets the query that this subscription is associated with. Regardless of the state of the subscription, this value will reflect the results in the local Realm. This allows you to data-bind to this property immediately and show the last synchronized data. If the State is Invalidated, the values returned will not be an adequate representation of the state of the remote Realm.
Declaration
public IQueryable<T> Results { get; }
Property Value
Type | Description |
---|---|
IQueryable<T> | A queryable collection that can be further filtered, ordered, or observed for changes. |
State
Gets a value indicating the state of this subscription.
Declaration
public SubscriptionState State { get; }
Property Value
Type | Description |
---|---|
SubscriptionState | The state of the subscription. |
Methods
| Improve this Doc View SourceWaitForSynchronizationAsync()
Waits for the subscription to complete synchronizing (equivalent to transitioning to the Complete state.
Declaration
public Task WaitForSynchronizationAsync()
Returns
Type | Description |
---|---|
Task | An awaitable task, that, upon completion, indicates that the objects matching the specified query have been synchronized to the local Realm. |
Events
| Improve this Doc View SourcePropertyChanged
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type | Description |
---|---|
PropertyChangedEventHandler |