Realm 12.4.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Realm --version 12.4.0                
NuGet\Install-Package Realm -Version 12.4.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="12.4.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Realm --version 12.4.0                
#r "nuget: Realm, 12.4.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=12.4.0

// Install Realm as a Cake Tool
#tool nuget:?package=Realm&version=12.4.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 Platform and Framework Compatibility 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 mongodb.com/docs/atlas/device-sdks/sdk/dotnet/. The API reference is located at mongodb.com/docs/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 is compatible.  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 (39)

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

Package Description

ItEnterprise.WmsStandard

ItEnterprise WmsStandard for Xamarin Forms

GitHub repositories (7)

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.
Piotrekol/CollectionManager
An extensive tool for creating, editing, and exporting of osu! collections.
realm/realm-draw
The official Realm Draw app used in promotional videos
Version Downloads Last updated
20.0.0 912 9/9/2024
12.4.1 0 9/16/2024
12.4.0 4,930 8/25/2024
12.3.0 20,263 7/20/2024
12.2.0 37,421 5/22/2024
12.1.0 10,221 5/1/2024
12.0.0 11,353 4/17/2024
11.7.0 80,842 2/5/2024
11.6.1 79,620 11/17/2023
11.6.0 19,160 11/4/2023
11.5.0 233,910 9/16/2023
11.4.0 29,267 8/16/2023
11.3.0 40,835 7/26/2023
11.2.0 15,957 7/8/2023
11.1.2 105,497 6/20/2023
11.1.1 6,631 6/19/2023
11.1.0 2,641 6/17/2023
11.0.0 42,772 5/8/2023
10.21.1 39,211 4/21/2023
10.21.0 23,632 3/24/2023
10.20.0 88,529 2/10/2023
10.19.0 34,722 1/6/2023
10.18.0 133,523 11/2/2022
10.17.0 90,761 10/6/2022
10.16.0 12,733 10/3/2022
10.15.1 107,907 8/8/2022
10.15.0 5,613 8/5/2022
10.14.0 180,160 6/2/2022
10.13.0 27,741 5/18/2022
10.12.0 18,151 5/5/2022
10.11.2 34,761 4/21/2022
10.11.1 21,482 3/31/2022
10.11.0 5,476 3/28/2022
10.10.0 95,260 2/28/2022
10.9.0 79,225 1/21/2022
10.8.0 38,044 1/17/2022
10.7.1 104,293 11/20/2021
10.7.0 7,167 11/10/2021
10.6.0 161,996 9/30/2021
10.5.1 18,088 9/22/2021
10.5.0 30,742 9/9/2021
10.4.1 3,739 9/3/2021
10.4.0 11,301 8/31/2021
10.3.0 138,371 7/7/2021
10.2.1 26,897 7/1/2021
10.2.0 27,711 6/15/2021
10.2.0-beta.2 771 5/5/2021
10.2.0-beta.1 355 4/12/2021
10.1.4 19,356 5/12/2021
10.1.3 22,153 4/29/2021
10.1.2 29,543 3/19/2021
10.1.1 22,450 2/25/2021
10.1.0 14,494 2/9/2021
10.0.1 7,332 2/2/2021
10.0.0-beta.6 436 1/26/2021
10.0.0-beta.5 644 1/19/2021 10.0.0-beta.5 is deprecated because it has critical bugs.
10.0.0-beta.3 1,159 12/10/2020
10.0.0-beta.2 1,479 11/4/2020
10.0.0-beta.1 732 10/16/2020
10.0.0-alpha.43 366 10/9/2020
10.0.0-alpha.34 476 10/4/2020
5.1.3 25,871 2/10/2021
5.1.2 84,288 10/20/2020
5.1.1 27,958 10/2/2020
5.1.0 7,203 9/30/2020
5.0.1 10,811 9/9/2020
4.3.0 275,699 2/5/2020
4.2.0 70,031 10/8/2019
4.1.0 86,864 8/6/2019
4.0.1 20,260 6/27/2019
4.0.0 6,287 6/14/2019
3.4.0 103,072 1/9/2019
3.3.0 26,373 11/8/2018
3.2.1 47,221 9/27/2018
3.2.0 16,285 9/4/2018
3.1.0 32,815 7/4/2018
3.0.0 109,441 4/16/2018
2.2.0 13,990 3/22/2018
2.1.0 55,033 11/13/2017
2.0.0 18,345 10/17/2017
2.0.0-rc1 2,584 10/3/2017
1.6.0 35,495 8/15/2017
1.5.0 18,008 6/20/2017
1.4.0 14,911 5/19/2017
1.3.0 3,740 5/16/2017
1.2.1 7,969 5/1/2017
1.2.0 5,966 4/4/2017
1.1.1 7,522 3/15/2017
1.1.0 3,698 3/3/2017
1.0.4 4,918 2/21/2017
1.0.3 17,078 2/14/2017
0.82.1 18,484 1/27/2017
0.82.0 3,354 1/23/2017
0.81.0 5,446 12/15/2016
0.80.0 11,553 10/27/2016
0.78.1 20,606 9/15/2016
0.78.0 2,759 9/11/2016
0.77.2 5,636 8/11/2016
0.77.1 3,190 7/28/2016
0.76.1 6,082 6/15/2016
0.76.0 3,417 6/9/2016
0.75.0 3,250 6/3/2016
0.74.1 5,861 5/10/2016

## 12.4.0 (2024-08-25)

### Enhancements
* Introduce a `ReconnectBackoffOptions` property on `SyncTimeoutOptions` that allows control over the delay the sync client applies before attempting to reconnect. (PR [#3661](https://github.com/realm/realm-dotnet/pull/3661)).
* Role and permissions changes no longer require a client reset to update the local realm. (Core 14.11.0)
* On Windows devices Device Sync will additionally look up SSL certificates in the Windows Trusted Root Certification Authorities certificate store when establishing a connection. (Core 14.11.0)
* Sync log statements now include the app services connection id in their prefix (e.g `Connection[1:<connection id>] Session[1]: log message`) to make correlating sync activity to server logs easier during troubleshooting. (Core 14.11.2)
* Improve sync bootstrap performance by reducing the number of table selections in the replication logs for embedded objects. (Core 14.12.0)
* Released a read lock which was pinned for the duration of a mutable subscription even after commit. This frees resources earlier, and may improve performance of sync bootstraps where the starting state is large. (Core 14.12.0)
* Client reset cycle detection now checks if the previous recovery attempt was made by the same core version, and if not attempts recovery again. (Core 14.12.0)
* Updated bundled OpenSSL version to 3.3.1. (Core 14.12.0)

### Fixed
* Sync download progress was only updated when bootstraps completed, making it always be 0 before the first completion and then forever 1. (Core 14.11.0)
* Sync client can crash if a session is resumed while the session is being suspended. (Core 14.11.0)
* If a sync session is interrupted by a disconnect or restart while downloading a bootstrap, stale data from the previous bootstrap may be included when the session reconnects and downloads the bootstrap. This can lead to objects stored in the database that do not match the actual state of the server and potentially leading to compensating writes. (Core 14.11.0)
* Fixed unnecessary server roundtrips when there is no download to acknowledge. (Core 14.11.0)
* App subscription callback was getting fired before the user profile was retrieved on login, leading to an empty user profile when using the callback. (Core 14.11.1)
* Sync client may report duplicate compensating write errors. (Core 14.11.2)
* Fixed an "invalid column key" exception when using a RQL "BETWEEN" query on an int or timestamp property across links. (Core 14.12.0)
* Fixed conflict resolution bug related to ArrayErase and Clear instructions, which could sometimes cause an "Invalid prior_size" exception to prevent synchronization. (Core 14.12.0)
* Fixed bug which would prevent eventual consistency during conflict resolution. Affected clients would experience data divergence and potentially consistency errors as a result. (Core 14.12.0)
* Fixed issues loading the native Realm libraries on Linux ARMv7 systems when they linked against our bundled OpenSSL resulting in errors like `unexpected reloc type 0x03`. (Core 14.12.0)
* `Realm.Copy()` would sometimes incorrectly throw an exception claiming that there were unuploaded local changes when the source Realm is a synchronized Realm. (Core 14.12.0)

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

### Internal
* Using Core 14.12.0.