Search Results for

    Show / Hide Table of Contents

    Class FlexibleSyncConfiguration

    A FlexibleSyncConfiguration is used to setup a Realm whose data can be synchronized between devices using Atlas Device Sync. Unlike PartitionSyncConfiguration, a Realm opened with FlexibleSyncConfiguration will be initially empty until one or more subscriptions are added via Subscriptions.

    Inheritance
    Object
    RealmConfigurationBase
    SyncConfigurationBase
    FlexibleSyncConfiguration
    Inherited Members
    SyncConfigurationBase.User
    SyncConfigurationBase.ClientResetHandler
    SyncConfigurationBase.OnSessionError
    RealmConfigurationBase.DefaultRealmName
    RealmConfigurationBase.DatabasePath
    RealmConfigurationBase.FallbackPipePath
    RealmConfigurationBase.IsDynamic
    RealmConfigurationBase.ObjectClasses
    RealmConfigurationBase.Schema
    RealmConfigurationBase.GetPathToRealm(String)
    RealmConfigurationBase.SchemaVersion
    RealmConfigurationBase.EncryptionKey
    RealmConfigurationBase.MaxNumberOfActiveVersions
    Namespace: Realms.Sync
    Assembly: Realm.dll
    Syntax
    public class FlexibleSyncConfiguration : SyncConfigurationBase

    Constructors

    | Improve this Doc View Source

    FlexibleSyncConfiguration(User, String)

    Initializes a new instance of the FlexibleSyncConfiguration class.

    Declaration
    public FlexibleSyncConfiguration(User user, string optionalPath = null)
    Parameters
    Type Name Description
    User user

    A valid User.

    String optionalPath

    Path to the realm, must be a valid full path for the current platform, relative subdirectory, or just filename.

    Properties

    | Improve this Doc View Source

    PopulateInitialSubscriptions

    Gets or sets a callback that will be invoked the first time a Realm is opened.

    Declaration
    public FlexibleSyncConfiguration.InitialSubscriptionsDelegate PopulateInitialSubscriptions { get; set; }
    Property Value
    Type Description
    FlexibleSyncConfiguration.InitialSubscriptionsDelegate

    The FlexibleSyncConfiguration.InitialSubscriptionsDelegate that will be invoked the first time a Realm is opened.

    Remarks

    This callback allows you to populate an initial set of subscriptions, which will then be awaited when GetInstance(RealmConfigurationBase) is invoked.
    The SubscriptionSet returned by Subscriptions is already called in an Update(Action) block, so there's no need to start one inside the callback.

    Examples
    var config = new FlexibleSyncConfiguration(user)
    {
        PopulateInitialSubscriptions = (realm) =>
        {
            var myNotes = realm.All<Note>().Where(n => n.AuthorId == myUserId);
            realm.Subscriptions.Add(myNotes);
        }
    };
    
    // The task will complete when all the user notes have been downloaded.
    var realm = await Realm.GetInstanceAsync(config);

    See Also

    Sync Docs
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2020 Realm
    Generated by DocFX