Search Results for

    Show / Hide Table of Contents

    Class RealmConfigurationBase

    Base class for specifying configuration settings that affect the Realm's behavior.
    Its main role is generating a canonical path from whatever absolute, relative subdirectory, or just filename the user supplies.

    Inheritance
    object
    RealmConfigurationBase
    InMemoryConfiguration
    RealmConfiguration
    Namespace: Realms
    Assembly: Realm.dll
    Syntax
    public abstract class RealmConfigurationBase

    Properties

    | Edit this page View Source

    DatabasePath

    Gets the full path of the Realms opened with this Configuration. May be overridden by passing in a separate name.

    Declaration
    public string DatabasePath { get; }
    Property Value
    Type Description
    string

    The absolute path to the Realm.

    | Edit this page View Source

    DefaultRealmName

    Gets the filename to be combined with the platform-specific document directory.

    Declaration
    public static string DefaultRealmName { get; }
    Property Value
    Type Description
    string

    A string representing a filename only, no path.

    | Edit this page View Source

    FallbackPipePath

    Gets or sets the path where the named pipes used by Realm can be placed.

    Declaration
    public string? FallbackPipePath { get; set; }
    Property Value
    Type Description
    string

    The path where named pipes can be created.

    Remarks

    In the vast majority of cases this value should be left null. It needs to be set if the Realm is opened on a filesystem where a named pipe cannot be created, such as external storage on Android that uses FAT32. In this case the path should point to a location on a filesystem where the pipes can be created.

    | Edit this page View Source

    IsDynamic

    Gets or sets a value indicating whether the Realm will be open in dynamic mode. If opened in dynamic mode, the schema will be read from the file on disk.

    Declaration
    public bool IsDynamic { get; set; }
    Property Value
    Type Description
    bool

    true if the Realm will be opened in dynamic mode; false otherwise.

    | Edit this page View Source

    MaxNumberOfActiveVersions

    Gets or sets the maximum number of active versions allowed before an exception is thrown.

    Declaration
    public ulong MaxNumberOfActiveVersions { get; set; }
    Property Value
    Type Description
    ulong
    See Also
    Freeze()
    | Edit this page View Source

    Schema

    Gets or sets the schema of the Realm opened with this configuration.

    Declaration
    public RealmSchema Schema { get; set; }
    Property Value
    Type Description
    RealmSchema

    The schema of the types that can be persisted in the Realm.

    Remarks

    Typically left null so by default all IRealmObject and IEmbeddedObject instance will be able to be stored in all Realms.
    If specifying the schema explicitly, you can either use the implicit conversion operator from Type[] to RealmSchema or construct it using the RealmSchema.Builder API.

    Examples
    config.Schema = new Type[]
    {
        typeof(CommonClass),
        typeof(RareClass)
    };
    
    // Alternatively
    config.Schema = new RealmSchema.Builder
    {
        new ObjectSchema.Builder("Person")
        {
            Property.Primitive("Name", RealmValueType.String, isPrimaryKey: true),
            Property.Primitive("Birthday", RealmValueType.Date, isNullable: true),
            Property.ObjectList("Addresses", objectType: "Address")
        },
        new ObjectSchema.Builder("Address")
        {
            Property.Primitive("City", RealmValueType.String),
            Property.Primitive("Street", RealmValueType.String),
        }
    }
    | Edit this page View Source

    SchemaVersion

    Gets or sets a number, indicating the version of the schema. Can be used to arbitrarily distinguish between schemas even if they have the same objects and properties.

    Declaration
    public ulong SchemaVersion { get; set; }
    Property Value
    Type Description
    ulong

    0-based value initially set to zero so all user-set values will be greater.

    | Edit this page View Source

    ShouldCompactOnLaunch

    Gets or sets the compact on launch callback.

    Declaration
    public RealmConfigurationBase.ShouldCompactDelegate? ShouldCompactOnLaunch { get; set; }
    Property Value
    Type Description
    RealmConfigurationBase.ShouldCompactDelegate

    The RealmConfigurationBase.ShouldCompactDelegate that will be invoked when opening a Realm for the first time to determine if it should be compacted before being returned to the user.

    Methods

    | Edit this page View Source

    GetPathToRealm(string?)

    Utility to build a path in which a Realm will be created so can consistently use filenames and relative paths.

    Declaration
    public static string GetPathToRealm(string? optionalPath = null)
    Parameters
    Type Name Description
    string optionalPath

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

    Returns
    Type Description
    string

    A full path including name of Realm file.

    • Edit this page
    • View Source
    In this article
    Back to top Copyright © 2020-2024 Realm
    Generated by DocFX