Show / Hide Table of Contents

    Class Subscription

    A set of extension methods exposing query-based sync related functionality over collections.

    Inheritance
    Object
    Subscription
    Namespace: Realms.Sync
    Assembly: Realm.dll
    Syntax
    public static class Subscription

    Methods

    | Improve this Doc View Source

    GetAllSubscriptions(Realm)

    Returns all subscriptions registered for that Realm.

    Declaration
    public static IRealmCollection<NamedSubscription> GetAllSubscriptions(this Realm realm)
    Parameters
    Type Name Description
    Realm realm

    A Realm opened with a QueryBasedSyncConfiguration.

    Returns
    Type Description
    IRealmCollection<NamedSubscription>

    A queryable collection of all registered subscriptions.

    | Improve this Doc View Source

    Subscribe<T>(IQueryable<T>, SubscriptionOptions, Expression<Func<T, IQueryable>>[])

    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, SubscriptionOptions options = null, params Expression<Func<T, IQueryable>>[] includedBacklinks)
    Parameters
    Type Name Description
    IQueryable<T> query

    A query, obtained by calling All<T>() with or without additional filtering applied.

    SubscriptionOptions options

    Options that configure some metadata of the subscription, such as its name or time to live.

    Expression<Func<T, IQueryable>>[] includedBacklinks

    An array of property expressions which specifies which linkingObjects relationships should be included in the subscription. Subscriptions already include link and list properties (in the forward direction) automatically by default.

    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 query is null.

    ArgumentException

    Thrown if the query was not obtained from a query-based synchronized Realm.

    | Improve this Doc View Source

    Subscribe<T>(IQueryable<T>, String)

    For Realms using query-based synchronization, fetches and synchronizes the objects that match the query.

    Declaration
    [Obsolete("Use Subscribe(query, options) instead.")]
    public static Subscription<T> Subscribe<T>(this IQueryable<T> query, string name)
    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 query is null.

    ArgumentException

    Thrown if the query was not obtained from a query-based synchronized Realm.

    | Improve this Doc View Source

    UnsubscribeAsync(Realm, String)

    Cancel a named subscription that was created by calling Subscribe<T>(IQueryable<T>, SubscriptionOptions, Expression<Func<T, IQueryable>>[]).

    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.

    | Improve this Doc View Source

    UnsubscribeAsync<T>(Subscription<T>)

    Cancel a subscription that was created by calling Subscribe<T>(IQueryable<T>, SubscriptionOptions, Expression<Func<T, IQueryable>>[]).

    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.

    • Improve this Doc
    • View Source
    Back to top Copyright © 2019 Realm
    Generated by DocFX