Realm Xamarin
Realm for Xamarin
|
A Realm instance (also referred to as a realm) represents a Realm database. More...
Inherits IDisposable.
Public Member Functions | |
RealmResults< T > | All< T > () |
Extract an iterable set of objects for direct use or further query. More... | |
Transaction | BeginWrite () |
Factory for a write Transaction. Essential object to create scope for updates. More... | |
void | Close () |
Closes the Realm if not already closed. Safe to call repeatedly. More... | |
T | CreateObject< T > () |
Factory for a managed object in a realm. Only valid within a Write transaction. More... | |
void | Dispose () |
Dispose automatically closes the Realm if not already closed. More... | |
override bool | Equals (Object rhs) |
Generic override determines whether the specified System.Object is equal to the current Realm. More... | |
bool | Equals (Realm rhs) |
Determines whether the specified Realm is equal to the current Realm. More... | |
override int | GetHashCode () |
Serves as a hash function for a Realm based on the core instance. More... | |
bool | IsSameInstance (Realm rhs) |
Determines whether this instance is the same core instance as the specified rhs. More... | |
void | Manage< T > (T obj) |
This realm will start managing a RealmObject which has been created as a standalone object. More... | |
void | Remove (RealmObject obj) |
Removes a persistent object from this realm, effectively deleting it. More... | |
Static Public Member Functions | |
static void | DeleteRealm (RealmConfiguration configuration) |
Deletes all the files associated with a realm. Hides knowledge of the auxiliary filenames from the programmer. More... | |
static Realm | GetInstance (string databasePath) |
Factory for a Realm instance for this thread. More... | |
static Realm | GetInstance (RealmConfiguration config=null) |
Factory for a Realm instance for this thread. More... | |
Public Attributes | |
bool | IsClosed => _sharedRealmHandle.IsClosed |
Checks if database has been closed. More... | |
Properties | |
RealmConfiguration | Config [get] |
Configuration that controls the Realm path and other settings. More... | |
A Realm instance (also referred to as a realm) represents a Realm database.
Warning: Realm instances are not thread safe and can not be shared across threads You must call GetInstance on each thread in which you want to interact with the realm.
RealmResults<T> All< T > | ( | ) |
Extract an iterable set of objects for direct use or further query.
T | The Type T must not only be a RealmObject but also have been processd by the Fody weaver, so it has persistent properties. |
T | : | RealmObject |
Transaction BeginWrite | ( | ) |
Factory for a write Transaction. Essential object to create scope for updates.
using (var trans = myrealm.BeginWrite()) { var rex = myrealm.CreateObject<Dog>(); rex.Name = "Rex"; trans.Commit(); }
void Close | ( | ) |
Closes the Realm if not already closed. Safe to call repeatedly.
Referenced by Realm.Dispose().
T CreateObject< T > | ( | ) |
Factory for a managed object in a realm. Only valid within a Write transaction.
Using CreateObject is more efficient than creating standalone objects, assigning their values, then using Manage because it avoids copying properties to the realm.
T | The Type T must not only be a RealmObject but also have been processd by the Fody weaver, so it has persistent properties. |
RealmOutsideTransactionException | If you invoke this when there is no write Transaction active on the realm. |
T | : | RealmObject |
|
static |
Deletes all the files associated with a realm. Hides knowledge of the auxiliary filenames from the programmer.
configuration | A configuration which supplies the realm path. |
References RealmConfiguration.DatabasePath.
Referenced by Realm.GetInstance().
void Dispose | ( | ) |
Dispose automatically closes the Realm if not already closed.
References Realm.Close().
override bool Equals | ( | Object | rhs | ) |
bool Equals | ( | Realm | rhs | ) |
Determines whether the specified Realm is equal to the current Realm.
true
if the Realms are functionally equal.References Realm.Config, RealmConfiguration.Equals(), and Realm.IsClosed.
override int GetHashCode | ( | ) |
Serves as a hash function for a Realm based on the core instance.
|
static |
Factory for a Realm instance for this thread.
databasePath | Path to the realm, must be a valid full path for the current platform, relative subdir, or just filename. |
If you specify a relative path, sandboxing by the OS may cause failure if you specify anything other than a subdirectory.
Instances are cached for a given absolute path and thread, so you may get back the same instance.
RealmFileAccessErrorException | Throws error if the filesystem has an error preventing file creation. |
References RealmConfiguration.ConfigWithPath(), and RealmConfiguration.DefaultConfiguration.
|
static |
Factory for a Realm instance for this thread.
config | Optional configuration. |
RealmFileAccessErrorException | Throws error if the filesystem has an error preventing file creation. |
References Realm.Config, RealmConfiguration.DefaultConfiguration, Realm.DeleteRealm(), and RealmConfiguration.SchemaVersion.
bool IsSameInstance | ( | Realm | rhs | ) |
Determines whether this instance is the same core instance as the specified rhs.
You can, and should, have multiple instances open on different threads which have the same path and open the same Realm.
true
if this instance is the same core instance the specified rhs; otherwise, false
.void Manage< T > | ( | T | obj | ) |
This realm will start managing a RealmObject which has been created as a standalone object.
T | The Type T must not only be a RealmObject but also have been processd by the Fody weaver, so it has persistent properties. |
obj | Must be a standalone object, null not allowed. |
RealmOutsideTransactionException | If you invoke this when there is no write Transaction active on the realm. |
RealmObjectAlreadyManagedByRealmException | You can't manage the same object twice. This exception is thrown, rather than silently detecting the mistake, to help you debug your code |
RealmObjectManagedByAnotherRealmException | You can't manage an object with more than one realm |
T | : | RealmObject |
void Remove | ( | RealmObject | obj | ) |
Removes a persistent object from this realm, effectively deleting it.
obj | Must be an object persisted in this realm. |
RealmOutsideTransactionException | If you invoke this when there is no write Transaction active on the realm. |
System.ArgumentNullException | If you invoke this with a standalone object. |
bool IsClosed => _sharedRealmHandle.IsClosed |
|
get |
Configuration that controls the Realm path and other settings.
Referenced by Realm.Equals(), and Realm.GetInstance().