Show / Hide Table of Contents

    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>, SubscriptionOptions, Expression<Func<T, IQueryable>>[]).

    Inheritance
    Object
    Subscription<T>
    Implements
    INotifyPropertyChanged
    Namespace: Realms.Sync
    Assembly: Realm.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 Source

    Error

    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; null otherwise.

    | Improve this Doc View Source

    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.

    | Improve this Doc View Source

    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 Source

    WaitForSynchronizationAsync()

    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 Source

    PropertyChanged

    Occurs when a property value changes.

    Declaration
    public event PropertyChangedEventHandler PropertyChanged
    Event Type
    Type Description
    PropertyChangedEventHandler

    Implements

    System.ComponentModel.INotifyPropertyChanged

    Extension Methods

    Subscription.UnsubscribeAsync<T>(Subscription<T>)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Realm
    Generated by DocFX