Realm Xamarin  v0.81.0
Realm for Xamarin
Public Member Functions | Properties | List of all members
Realms.RealmConfiguration Class Reference

Realm configuration specifying settings that affect the Realm's behavior. More...

Inheritance diagram for Realms.RealmConfiguration:
Inheritance graph
[legend]
Collaboration diagram for Realms.RealmConfiguration:
Collaboration graph
[legend]

Public Member Functions

 RealmConfiguration (string optionalPath=null)
 Initializes a new instance of the RealmConfiguration class. More...
 
RealmConfiguration ConfigWithPath (string newConfigPath)
 Clone method allowing you to override or customize the current path. More...
 
delegate void MigrationCallbackDelegate (Migration migration, ulong oldSchemaVersion)
 In order to handle manual migrations, you need to supply one of these to your RealmConfiguration. It will be called with a Migration instance containing the pre- and the post-migration realm. You should make sure that the NewRealm property on it contains a database that is up to date when returning. The oldSchemaVersion parameter will tell you which version the user is migrating from. They should always be migrating to the current version. More...
 

Properties

static RealmConfiguration DefaultConfiguration [get, set]
 Gets or sets the configuration that is used when creating a new Realm without specifying a configuration. More...
 
bool IsReadOnly [get, set]
 Gets or sets a value indicating whether a Realm is opened as readonly. This allows opening it from locked locations such as resources, bundled with an application. More...
 
MigrationCallbackDelegate MigrationCallback [get, set]
 Gets or sets the migration callback. More...
 
bool ShouldDeleteIfMigrationNeeded [get, set]
 Gets or sets a value indicating whether the database will be deleted if the schema mismatches the one in the code. Use this when debugging and developing your app but never release it with this flag set to true. More...
 
- Properties inherited from Realms.RealmConfigurationBase
string DatabasePath [get, protected set]
 Gets or sets the full path of the realms opened with this configuration, may be overriden by passing in a separate name. More...
 
byte [] EncryptionKey [get, set]
 Gets or sets the key, used to encrypt the entire Realm. Once set, must be specified each time file is used. More...
 
Type [] ObjectClasses [get, set]
 Gets or sets the list of classes persisted in a Realm opened with this configuration. More...
 
ulong SchemaVersion [get, set]
 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. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Realms.RealmConfigurationBase
static string GetPathToRealm (string optionalPath=null)
 Utility to build a path in which a realm will be created so can consistently use filenames and relative paths. More...
 
- Static Public Attributes inherited from Realms.RealmConfigurationBase
static string DefaultRealmName => "default.realm"
 Gets the filename to be combined with the platform-specific document directory. More...
 

Detailed Description

Realm configuration specifying 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.

Constructor & Destructor Documentation

§ RealmConfiguration()

Realms.RealmConfiguration.RealmConfiguration ( string  optionalPath = null)

Initializes a new instance of the RealmConfiguration class.

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

Referenced by Realms.RealmConfiguration.ConfigWithPath().

Member Function Documentation

§ ConfigWithPath()

RealmConfiguration Realms.RealmConfiguration.ConfigWithPath ( string  newConfigPath)

Clone method allowing you to override or customize the current path.

Returns
An object with a fully-specified, canonical path.
Parameters
newConfigPathPath to the realm, must be a valid full path for the current platform, relative subdirectory, or just filename.

References Realms.RealmConfigurationBase.DatabasePath, Realms.RealmConfigurationBase.DefaultRealmName, Realms.RealmConfigurationBase.EncryptionKey, Realms.RealmConfiguration.IsReadOnly, Realms.RealmConfiguration.MigrationCallback, Realms.RealmConfiguration.RealmConfiguration(), Realms.RealmConfigurationBase.SchemaVersion, and Realms.RealmConfiguration.ShouldDeleteIfMigrationNeeded.

Referenced by Realms.Realm.GetInstance().

§ MigrationCallbackDelegate()

delegate void Realms.RealmConfiguration.MigrationCallbackDelegate ( Migration  migration,
ulong  oldSchemaVersion 
)

In order to handle manual migrations, you need to supply one of these to your RealmConfiguration. It will be called with a Migration instance containing the pre- and the post-migration realm. You should make sure that the NewRealm property on it contains a database that is up to date when returning. The oldSchemaVersion parameter will tell you which version the user is migrating from. They should always be migrating to the current version.

Parameters
migrationThe Migration instance, containing information about the old and the new realm.
oldSchemaVersionAn unsigned long value indicating the schema version of the old realm.

Property Documentation

§ DefaultConfiguration

RealmConfiguration Realms.RealmConfiguration.DefaultConfiguration
staticgetset

Gets or sets the configuration that is used when creating a new Realm without specifying a configuration.

Referenced by Realms.Realm.GetInstance().

§ IsReadOnly

bool Realms.RealmConfiguration.IsReadOnly
getset

Gets or sets a value indicating whether a Realm is opened as readonly. This allows opening it from locked locations such as resources, bundled with an application.

Referenced by Realms.RealmConfiguration.ConfigWithPath().

§ MigrationCallback

MigrationCallbackDelegate Realms.RealmConfiguration.MigrationCallback
getset

Gets or sets the migration callback.

Referenced by Realms.RealmConfiguration.ConfigWithPath().

§ ShouldDeleteIfMigrationNeeded

bool Realms.RealmConfiguration.ShouldDeleteIfMigrationNeeded
getset

Gets or sets a value indicating whether the database will be deleted if the schema mismatches the one in the code. Use this when debugging and developing your app but never release it with this flag set to true.

Referenced by Realms.RealmConfiguration.ConfigWithPath().