Realm 11.7.0

dotnet add package Realm --version 11.7.0
NuGet\Install-Package Realm -Version 11.7.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Realm" Version="11.7.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Realm --version 11.7.0
#r "nuget: Realm, 11.7.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Realm as a Cake Addin
#addin nuget:?package=Realm&version=11.7.0

// Install Realm as a Cake Tool
#tool nuget:?package=Realm&version=11.7.0

<picture> <source srcset="./media/logo-dark.svg" media="(prefers-color-scheme: dark)" alt="realm by MongoDB"> <img src="./media/logo.svg" alt="realm by MongoDB"> </picture>

Realm is a mobile database that runs directly on phones, tablets or wearables. It supports all major mobile and desktop operating systems, such as iOS, Android, UWP, macOS, Linux, and Windows. For a full list of supported platforms and their versions, check out the Supported Platforms sub-section in the documentation.

Features

  • Mobile-first: Realm is the first database built from the ground up to run directly inside phones, tablets, and wearables.
  • Simple: Data is directly exposed as objects and queryable by code, removing the need for ORM's riddled with performance & maintenance issues. Plus, we've worked hard to keep our API down to just a few common classes: most of our users pick it up intuitively, getting simple apps up & running in minutes.
  • Modern: Realm supports relationships, generics, vectorization and modern C# idioms.
  • Fast: Realm is faster than even raw SQLite on common operations while maintaining an extremely rich feature set.
  • Device Sync: Makes it simple to keep data in sync across users, devices, and your backend in real-time. Get started for free with a template application and create the cloud backend.

Getting Started

Model definition

Define a persistable model by inheriting from IRealmObject. The Realm source generator will generate an implementation for most of the functionality, so you only need to specify the properties you want to persist:

public partial class Person : IRealmObject
{
    [PrimaryKey]
    public ObjectId Id { get; private set; } = ObjectId.GenerateNewId();

    public string FirstName { get; set; }

    public string LastName { get; set; }

    public DateTimeOffset Birthday { get; set; }

    // You can define constructors as usual
    public Person(string firstName, string lastName)
    {
        FirstName = firstName;
        LastName = lastName;
    }
}

Open a Realm file

Open a Realm instance by calling Realm.GetInstance:

// You can provide a relative or an absolute path to the Realm file or let
// Realm use the default one.
var realm = Realm.GetInstance("people.realm");

CRUD operations

Add, read, update, and remove objects by calling the corresponding API on the Realm instance:

// Always mutate the Realm instance in a write transaction
realm.Write(() =>
{
    realm.Add(new Person("John", "Smith"));
});

var peopleWithJ = realm.All<Person>().Where(p => p.FirstName.StartsWith("J"));

// All Realm collections and objects are reactive and implement INotifyCollectionChanged/INotifyPropertyChanged

peopleWithJ.AsRealmCollection().CollectionChanged += (s, e) =>
{
    // React to notifications
};

For more examples, see the detailed instructions in our User Guide to add Realm to your solution.

Documentation

The documentation can be found at docs.mongodb.com/realm/dotnet/. The API reference is located at docs.mongodb.com/realm-sdks/dotnet/latest/.

Getting Help

  • Need help with your code?: Look for previous questions on the #realm tag — or ask a new question. You can also check out our Community Forum where general questions about how to do something can be discussed.
  • Have a bug to report? Open an issue. If possible, include the version of Realm, a full log, the Realm file, and a project that shows the issue.
  • Have a feature request? Open an issue. Tell us what the feature should do, and why you want the feature.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid is compatible. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios is compatible. 
Xamarin.Mac xamarinmac is compatible. 
Xamarin.TVOS xamarintvos is compatible. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (38)

Showing the top 5 NuGet packages that depend on Realm:

Package Downloads
ppy.osu.Game

Package Description

Iridium360.Connect.Framework

This framework allows you to bind your Android or iOS device with i360RockSTAR tracker

ItEnterprise.Common.CoreStandard

ItEnterprise Common.CoreStandard for Xamarin Forms

Arc4u.Standard.Diagnostics.Serilog.Sinks.RealmDb

Arc4u Diagnostics Serilog Sink to RealmDB

ItEnterprise.WmsStandard

ItEnterprise WmsStandard for Xamarin Forms

GitHub repositories (5)

Showing the top 5 popular GitHub repositories that depend on Realm:

Repository Stars
ppy/osu
rhythm is just a *click* away!
realm/realm-dotnet
Realm is a mobile database: a replacement for SQLite & ORMs
sgermosen/xReader
XML, NEWS, RSS & Scrapping Reader maked in Xamarin, for educational purpose.
realm/realm-draw
The official Realm Draw app used in promotional videos
dsa28s/windows-hangul-clock
Hangul Clock for Windows Desktop Widget
Version Downloads Last updated
11.7.0 27,079 2/5/2024
11.6.1 51,544 11/17/2023
11.6.0 9,394 11/4/2023
11.5.0 144,895 9/16/2023
11.4.0 21,523 8/16/2023
11.3.0 29,161 7/26/2023
11.2.0 14,317 7/8/2023
11.1.2 93,716 6/20/2023
11.1.1 5,221 6/19/2023
11.1.0 2,358 6/17/2023
11.0.0 34,327 5/8/2023
10.21.1 31,136 4/21/2023
10.21.0 21,433 3/24/2023
10.20.0 84,846 2/10/2023
10.19.0 31,245 1/6/2023
10.18.0 120,660 11/2/2022
10.17.0 83,316 10/6/2022
10.16.0 12,182 10/3/2022
10.15.1 102,240 8/8/2022
10.15.0 5,262 8/5/2022
10.14.0 168,016 6/2/2022
10.13.0 26,424 5/18/2022
10.12.0 17,783 5/5/2022
10.11.2 34,296 4/21/2022
10.11.1 19,922 3/31/2022
10.11.0 5,123 3/28/2022
10.10.0 92,951 2/28/2022
10.9.0 71,749 1/21/2022
10.8.0 37,143 1/17/2022
10.7.1 100,893 11/20/2021
10.7.0 6,886 11/10/2021
10.6.0 156,394 9/30/2021
10.5.1 17,724 9/22/2021
10.5.0 30,246 9/9/2021
10.4.1 3,401 9/3/2021
10.4.0 10,955 8/31/2021
10.3.0 136,254 7/7/2021
10.2.1 26,399 7/1/2021
10.2.0 26,048 6/15/2021
10.2.0-beta.2 761 5/5/2021
10.2.0-beta.1 350 4/12/2021
10.1.4 18,815 5/12/2021
10.1.3 19,636 4/29/2021
10.1.2 29,123 3/19/2021
10.1.1 21,876 2/25/2021
10.1.0 12,696 2/9/2021
10.0.1 6,652 2/2/2021
10.0.0-beta.6 430 1/26/2021
10.0.0-beta.5 636 1/19/2021
10.0.0-beta.3 1,150 12/10/2020
10.0.0-beta.2 1,464 11/4/2020
10.0.0-beta.1 727 10/16/2020
10.0.0-alpha.43 360 10/9/2020
10.0.0-alpha.34 469 10/4/2020
5.1.3 24,090 2/10/2021
5.1.2 82,355 10/20/2020
5.1.1 26,833 10/2/2020
5.1.0 6,187 9/30/2020
5.0.1 10,576 9/9/2020
4.3.0 267,250 2/5/2020
4.2.0 69,301 10/8/2019
4.1.0 86,098 8/6/2019
4.0.1 19,693 6/27/2019
4.0.0 6,061 6/14/2019
3.4.0 100,506 1/9/2019
3.3.0 25,871 11/8/2018
3.2.1 43,433 9/27/2018
3.2.0 14,932 9/4/2018
3.1.0 32,180 7/4/2018
3.0.0 108,082 4/16/2018
2.2.0 12,444 3/22/2018
2.1.0 54,117 11/13/2017
2.0.0 18,176 10/17/2017
2.0.0-rc1 2,410 10/3/2017
1.6.0 35,255 8/15/2017
1.5.0 17,854 6/20/2017
1.4.0 14,714 5/19/2017
1.3.0 3,585 5/16/2017
1.2.1 7,805 5/1/2017
1.2.0 5,827 4/4/2017
1.1.1 7,383 3/15/2017
1.1.0 3,534 3/3/2017
1.0.4 4,762 2/21/2017
1.0.3 16,931 2/14/2017
0.82.1 18,350 1/27/2017
0.82.0 3,254 1/23/2017
0.81.0 5,340 12/15/2016
0.80.0 11,180 10/27/2016
0.78.1 20,475 9/15/2016
0.78.0 2,640 9/11/2016
0.77.2 5,520 8/11/2016
0.77.1 3,098 7/28/2016
0.76.1 5,966 6/15/2016
0.76.0 3,250 6/9/2016
0.75.0 3,071 6/3/2016
0.74.1 5,638 5/10/2016

## 11.7.0 (2024-02-05)

### Enhancements
* Automatic client reset recovery now does a better job of recovering changes when changesets were downloaded from the server after the unuploaded local changes were committed. If the local Realm happened to be fully up to date with the server prior to the client reset, automatic recovery should now always produce exactly the same state as if no client reset was involved. (Core 13.24.1)
* Exceptions thrown during bootstrap application will now be surfaced to the user rather than terminating the program with an unhandled exception. (Core 13.25.0)
* Allow the using `>`, `>=`, `<`, `<=` operators in `Realm.Filter()` queries for string constants. This is a case sensitive lexicographical comparison. Improved performance of RQL (`.Filter()`) queries on a non-linked string property using: >, >=, <, <=, operators and fixed behaviour that a null string should be evaluated as less than everything, previously nulls were not matched. (Core 13.26.0-14-gdf25f)

### Fixed
* Automatic client reset recovery would duplicate insertions in a list when recovering a write which made an unrecoverable change to a list (i.e. modifying or deleting a pre-existing entry), followed by a subscription change, followed by a write which added an entry to the list. (Core 13.24.0)
* During a client reset recovery a Set of links could be missing items, or an exception could be thrown that prevents recovery. (Core 13.24.0)
* During a client reset with recovery when recovering a move or set operation on a `IList<RealmObject>` or `IList<RealmValue>` that operated on indices that were not also added in the recovery, links to an object which had been deleted by another client while offline would be recreated by the recovering client. But the objects of these links would only have the primary key populated and all other fields would be default values. Now, instead of creating these zombie objects, the lists being recovered skip such deleted links. (Core 13.24.0)
* Errors encountered while reapplying local changes for client reset recovery on partition-based sync Realms would result in the client reset attempt not being recorded, possibly resulting in an endless loop of attempting and failing to automatically recover the client reset. (Core 13.24.0)
* Changesets have wrong timestamps if the local clock lags behind 2015-01-01T00:00:00Z. The sync client now throws an exception if that happens. (Core 13.24.1)
* If the very first open of a flexible sync Realm triggered a client reset, the configuration had an initial subscriptions callback, both before and after reset callbacks, and the initial subscription callback began a read transaction without ending it (which is normally going to be the case), opening the frozen Realm for the after reset callback would trigger a BadVersion exception. (Core 13.24.1)
* Automatic client reset recovery on flexible sync Realms would apply recovered changes in multiple write transactions, releasing the write lock in between. (Core 13.24.1)
* Having a class name of length 57 would make client reset crash as a limit of 56 was wrongly enforced. (Core 13.24.1)
* Fixed several causes of "decryption failed" exceptions that could happen when opening multiple encrypted Realm files in the same process while using Apple/linux and storing the Realms on an exFAT file system. (Core 13.24.1)
* Fixed several errors that could cause a crash of the sync client. (Core 13.25.0)
* Bad performance of initial Sync download involving many backlinks. (Core 13.25.1)
* Explicitly bumped the minimum version of System.Net.Security to 4.3.2 as 4.3.0 has been marked as vulnerable (more details can be found in the deprecation notice on the [NuGet page](System.Net.Security/4.3.0)).
* Handle EOPNOTSUPP when using posix_fallocate() and fallback to manually consume space. This should enable android users to open a Realm on restrictive filesystems. (Core 13.26.0)
* Application may crash with incoming_changesets.size() != 0 when a download message is mistaken for a bootstrap message. This can happen if the synchronization session is paused and resumed at a specific time. (Core 13.26.0)
* Fixed errors complaining about missing symbols such as `__atomic_is_lock_free` on ARMv7 Linux (Core 13.26.0)
* Uploading the changesets recovered during an automatic client reset recovery may lead to 'Bad server version' errors and a new client reset. (Core 13.26.0-14-gdf25f)
* Fixed invalid data in error reason string when registering a subscription change notification after the subscription has already failed. (Core 13.26.0-14-gdf25f)

### Compatibility
* Realm Studio: 13.0.0 or later.

### Internal
* Using Core v13.26.0-14-gdf25f.