Realm Xamarin
v0.80.0
Realm for Xamarin
|
Realm configuration specifying settings that affect the Realm's behavior. More...
Public Member Functions | |
RealmConfiguration (string optionalPath=null, bool shouldDeleteIfMigrationNeeded=false) | |
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... | |
override bool | Equals (object obj) |
Generic override determines whether the specified System.Object is equal to the current Realms.RealmConfiguration. More... | |
bool | Equals (RealmConfiguration rhs) |
Determines whether the specified RealmConfiguration is equal to the current RealmConfiguration. More... | |
override int | GetHashCode () |
Serves as a hash function for a RealmConfiguration based on its 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... | |
Static Public Member Functions | |
static string | PathToRealm (string optionalPath=null) |
Utility to build a path in which a realm will be created so can consistently use filenames and relative paths. More... | |
Public Attributes | |
bool | ReadOnly |
Flag to indicate Realm is opened readonly so can open from locked locations such as bundled with an application. More... | |
readonly bool | ShouldDeleteIfMigrationNeeded |
Flag indicating that 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... | |
Static Public Attributes | |
static string | DefaultRealmName => "default.realm" |
Gets the filename to be combined with the platform-specific document directory. More... | |
Properties | |
string | DatabasePath [get] |
Gets the full path of the realms opened with this configuration, may be overriden by passing in a separate name. More... | |
static RealmConfiguration | DefaultConfiguration [get, set] |
Gets or sets the configuration that is used when creating a new Realm without specifying a configuration. 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... | |
MigrationCallbackDelegate | MigrationCallback [get, set] |
Gets or sets the migration callback. 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... | |
Realm configuration specifying settings that affect the Realm's behavior.
Main role is generating a canonical path from whatever absolute, relative subdirectory or just filename the user supplies.
RealmConfiguration | ( | string | optionalPath = null , |
bool | shouldDeleteIfMigrationNeeded = false |
||
) |
Initializes a new instance of the RealmConfiguration class.
optionalPath | Path to the realm, must be a valid full path for the current platform, relative subdirectory, or just filename. |
shouldDeleteIfMigrationNeeded | Optional Flag mainly to help with temp databases and testing, indicates content can be abandoned when you change the schema. |
References RealmConfiguration.DatabasePath, and RealmConfiguration.PathToRealm().
Referenced by RealmConfiguration.ConfigWithPath().
RealmConfiguration ConfigWithPath | ( | string | newConfigPath | ) |
Clone method allowing you to override or customize the current path.
newConfigPath | Path to the realm, must be a valid full path for the current platform, relative subdirectory, or just filename. |
References RealmConfiguration.DatabasePath, and RealmConfiguration.RealmConfiguration().
Referenced by Realm.DeleteRealm(), and Realm.GetInstance().
override bool Equals | ( | object | obj | ) |
Generic override determines whether the specified System.Object is equal to the current Realms.RealmConfiguration.
obj | The System.Object to compare with the current Realms.RealmConfiguration. |
true
if the specified System.Object is equal to the current Realms.RealmConfiguration; otherwise, false
.Referenced by Realm.Equals().
bool Equals | ( | RealmConfiguration | rhs | ) |
Determines whether the specified RealmConfiguration is equal to the current RealmConfiguration.
rhs | The System.Object to compare with the current RealmConfiguration. |
true
if the specified System.Object is equal to the current Realms.RealmConfiguration; otherwise, false
.References RealmConfiguration.DatabasePath, RealmConfiguration.EncryptionKey, RealmConfiguration.GetHashCode(), RealmConfiguration.MigrationCallback, RealmConfiguration.ReadOnly, RealmConfiguration.SchemaVersion, and RealmConfiguration.ShouldDeleteIfMigrationNeeded.
override int GetHashCode | ( | ) |
Serves as a hash function for a RealmConfiguration based on its path.
Referenced by RealmConfiguration.Equals().
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.
migration | The Migration instance, containing information about the old and the new realm. |
oldSchemaVersion | An unsigned long value indicating the schema version of the old realm. |
|
static |
Utility to build a path in which a realm will be created so can consistently use filenames and relative paths.
optionalPath | Path to the realm, must be a valid full path for the current platform, relative subdirectory, or just filename. |
References RealmConfiguration.DefaultRealmName.
Referenced by RealmConfiguration.RealmConfiguration().
|
static |
Gets the filename to be combined with the platform-specific document directory.
A string representing a filename only, no path.
Referenced by RealmConfiguration.PathToRealm().
bool ReadOnly |
Flag to indicate Realm is opened readonly so can open from locked locations such as bundled with an application.
Referenced by RealmConfiguration.Equals().
readonly bool ShouldDeleteIfMigrationNeeded |
Flag indicating that 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 RealmConfiguration.Equals().
|
get |
Gets the full path of the realms opened with this configuration, may be overriden by passing in a separate name.
Referenced by RealmConfiguration.ConfigWithPath(), RealmConfiguration.Equals(), and RealmConfiguration.RealmConfiguration().
|
staticgetset |
Gets or sets the configuration that is used when creating a new Realm without specifying a configuration.
Referenced by Realm.DeleteRealm(), and Realm.GetInstance().
|
getset |
Gets or sets the key, used to encrypt the entire Realm. Once set, must be specified each time file is used.
Full 64byte (512bit) key for AES-256 encryption.
Referenced by RealmConfiguration.Equals().
|
getset |
Gets or sets the migration callback.
Referenced by RealmConfiguration.Equals().
|
getset |
Gets or sets the list of classes persisted in a Realm opened with this configuration.
Specify classes by type. Searched linearly so order in decreasing frequency of creating objects.
For example: config.ObjectClasses = new Type[] { typeof(CommonClass), typeof(RareClass) };
.
Typically left null so by default all RealmObjects will be able to be stored in all realms.
Referenced by Realm.GetInstance().
|
getset |
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.
0-based value initially set to zero so all user-set values will be greater.
Referenced by RealmConfiguration.Equals().