Realm 20.1.0
dotnet add package Realm --version 20.1.0
NuGet\Install-Package Realm -Version 20.1.0
<PackageReference Include="Realm" Version="20.1.0" />
<PackageVersion Include="Realm" Version="20.1.0" />
<PackageReference Include="Realm" />
paket add Realm --version 20.1.0
#r "nuget: Realm, 20.1.0"
#:package Realm@20.1.0
#addin nuget:?package=Realm&version=20.1.0
#tool nuget:?package=Realm&version=20.1.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 | Versions 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.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. |
-
.NETStandard 2.0
- Fody (>= 6.9.1)
- Microsoft.CSharp (>= 4.5.0)
- MongoDB.Bson (>= 2.21.0)
- Remotion.Linq (>= 2.2.0)
- System.Buffers (>= 4.5.1)
- System.Dynamic.Runtime (>= 4.3.0)
- System.Memory (>= 4.5.5)
- System.Net.Security (>= 4.3.2)
- System.Net.WebSockets.Client (>= 4.3.2)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Threading.Channels (>= 6.0.0)
-
net6.0
- Fody (>= 6.9.1)
- Microsoft.CSharp (>= 4.5.0)
- MongoDB.Bson (>= 2.21.0)
- Remotion.Linq (>= 2.2.0)
- System.Buffers (>= 4.5.1)
- System.Dynamic.Runtime (>= 4.3.0)
- System.Memory (>= 4.5.5)
- System.Net.Security (>= 4.3.2)
- System.Net.WebSockets.Client (>= 4.3.2)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Threading.Channels (>= 6.0.0)
-
net8.0
- Fody (>= 6.9.1)
- Microsoft.CSharp (>= 4.5.0)
- MongoDB.Bson (>= 2.21.0)
- Remotion.Linq (>= 2.2.0)
- System.Buffers (>= 4.5.1)
- System.Dynamic.Runtime (>= 4.3.0)
- System.Memory (>= 4.5.5)
- System.Net.Security (>= 4.3.2)
- System.Net.WebSockets.Client (>= 4.3.2)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Threading.Channels (>= 6.0.0)
NuGet packages (42)
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 7 popular GitHub repositories that depend on Realm:
| Repository | Stars |
|---|---|
|
ppy/osu
rhythm is just a *click* away!
|
|
|
LagrangeDev/Lagrange.Core
An Implementation of NTQQ Protocol, with Pure C#, Derived from Konata.Core
|
|
|
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.
|
|
|
kabiiQ/BeatmapExporter
osu!lazer beatmap exporter utility. Allowing mass export of beatmaps from the new osu!lazer file storage back into .osz files.
|
|
|
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 | |
|---|---|---|---|
| 20.1.0 | 206,682 | 1/7/2025 | |
| 20.0.0 | 62,179 | 9/9/2024 | |
| 12.5.0 | 25,946 | 1/2/2025 | |
| 12.4.1 | 46,768 | 9/16/2024 | |
| 12.4.0 | 43,549 | 8/25/2024 | |
| 12.3.0 | 62,562 | 7/20/2024 | |
| 12.2.0 | 66,512 | 5/22/2024 | |
| 12.1.0 | 18,393 | 5/1/2024 | |
| 12.0.0 | 14,131 | 4/17/2024 | |
| 11.7.0 | 122,487 | 2/5/2024 | |
| 11.6.1 | 103,964 | 11/17/2023 | |
| 11.6.0 | 29,110 | 11/4/2023 | |
| 11.5.0 | 329,884 | 9/16/2023 | |
| 11.4.0 | 41,129 | 8/16/2023 | |
| 11.3.0 | 69,535 | 7/26/2023 | |
| 11.2.0 | 20,397 | 7/8/2023 | |
| 11.1.2 | 119,901 | 6/20/2023 | |
| 11.1.1 | 8,878 | 6/19/2023 | |
| 11.1.0 | 2,973 | 6/17/2023 | |
| 11.0.0 | 61,385 | 5/8/2023 | |
| 10.21.1 | 60,394 | 4/21/2023 | |
| 10.21.0 | 26,325 | 3/24/2023 | |
| 10.20.0 | 94,667 | 2/10/2023 | |
| 10.19.0 | 38,950 | 1/6/2023 | |
| 10.18.0 | 146,174 | 11/2/2022 | |
| 10.17.0 | 100,306 | 10/6/2022 | |
| 10.16.0 | 13,232 | 10/3/2022 | |
| 10.15.1 | 115,139 | 8/8/2022 | |
| 10.15.0 | 6,028 | 8/5/2022 | |
| 10.14.0 | 206,439 | 6/2/2022 | |
| 10.13.0 | 29,134 | 5/18/2022 | |
| 10.12.0 | 18,917 | 5/5/2022 | |
| 10.11.2 | 35,833 | 4/21/2022 | |
| 10.11.1 | 22,504 | 3/31/2022 | |
| 10.11.0 | 5,780 | 3/28/2022 | |
| 10.10.0 | 98,378 | 2/28/2022 | |
| 10.9.0 | 83,662 | 1/21/2022 | |
| 10.8.0 | 39,263 | 1/17/2022 | |
| 10.7.1 | 113,889 | 11/20/2021 | |
| 10.7.0 | 7,576 | 11/10/2021 | |
| 10.6.0 | 192,265 | 9/30/2021 | |
| 10.5.1 | 19,578 | 9/22/2021 | |
| 10.5.0 | 31,489 | 9/9/2021 | |
| 10.4.1 | 4,015 | 9/3/2021 | |
| 10.4.0 | 11,602 | 8/31/2021 | |
| 10.3.0 | 142,653 | 7/7/2021 | |
| 10.2.1 | 28,092 | 7/1/2021 | |
| 10.2.0 | 30,121 | 6/15/2021 | |
| 10.2.0-beta.2 | 914 | 5/5/2021 | |
| 10.2.0-beta.1 | 478 | 4/12/2021 | |
| 10.1.4 | 20,827 | 5/12/2021 | |
| 10.1.3 | 24,129 | 4/29/2021 | |
| 10.1.2 | 30,227 | 3/19/2021 | |
| 10.1.1 | 23,038 | 2/25/2021 | |
| 10.1.0 | 19,646 | 2/9/2021 | |
| 10.0.1 | 9,406 | 2/2/2021 | |
| 10.0.0-beta.6 | 582 | 1/26/2021 | |
| 10.0.0-beta.5 | 899 | 1/19/2021 | |
| 10.0.0-beta.3 | 1,394 | 12/10/2020 | |
| 10.0.0-beta.2 | 1,634 | 11/4/2020 | |
| 10.0.0-beta.1 | 911 | 10/16/2020 | |
| 10.0.0-alpha.43 | 497 | 10/9/2020 | |
| 10.0.0-alpha.34 | 603 | 10/4/2020 | |
| 5.1.3 | 28,246 | 2/10/2021 | |
| 5.1.2 | 85,546 | 10/20/2020 | |
| 5.1.1 | 28,221 | 10/2/2020 | |
| 5.1.0 | 7,926 | 9/30/2020 | |
| 5.0.1 | 11,139 | 9/9/2020 | |
| 4.3.0 | 286,815 | 2/5/2020 | |
| 4.2.0 | 71,150 | 10/8/2019 | |
| 4.1.0 | 93,685 | 8/6/2019 | |
| 4.0.1 | 20,843 | 6/27/2019 | |
| 4.0.0 | 6,591 | 6/14/2019 | |
| 3.4.0 | 107,997 | 1/9/2019 | |
| 3.3.0 | 26,891 | 11/8/2018 | |
| 3.2.1 | 56,305 | 9/27/2018 | |
| 3.2.0 | 20,067 | 9/4/2018 | |
| 3.1.0 | 37,744 | 7/4/2018 | |
| 3.0.0 | 112,474 | 4/16/2018 | |
| 2.2.0 | 16,920 | 3/22/2018 | |
| 2.1.0 | 57,477 | 11/13/2017 | |
| 2.0.0 | 18,827 | 10/17/2017 | |
| 2.0.0-rc1 | 2,980 | 10/3/2017 | |
| 1.6.0 | 38,152 | 8/15/2017 | |
| 1.5.0 | 19,576 | 6/20/2017 | |
| 1.4.0 | 15,379 | 5/19/2017 | |
| 1.3.0 | 4,109 | 5/16/2017 | |
| 1.2.1 | 8,411 | 5/1/2017 | |
| 1.2.0 | 6,434 | 4/4/2017 | |
| 1.1.1 | 7,901 | 3/15/2017 | |
| 1.1.0 | 4,098 | 3/3/2017 | |
| 1.0.4 | 5,338 | 2/21/2017 | |
| 1.0.3 | 17,474 | 2/14/2017 | |
| 0.82.1 | 19,030 | 1/27/2017 | |
| 0.82.0 | 4,014 | 1/23/2017 | |
| 0.81.0 | 5,979 | 12/15/2016 | |
| 0.80.0 | 12,155 | 10/27/2016 | |
| 0.78.1 | 21,001 | 9/15/2016 | |
| 0.78.0 | 3,145 | 9/11/2016 | |
| 0.77.2 | 6,020 | 8/11/2016 | |
| 0.77.1 | 3,607 | 7/28/2016 | |
| 0.76.1 | 6,461 | 6/15/2016 | |
| 0.76.0 | 3,833 | 6/9/2016 | |
| 0.75.0 | 3,638 | 6/3/2016 | |
| 0.74.1 | 6,935 | 5/10/2016 |
## 20.1.0 (2025-01-07)
### Breaking Changes
* Support for UWP on arm32 has been removed due to the Windows SDK no longer supporting 32-bit ARM. (PR [#3683](https://github.com/realm/realm-dotnet/pull/3683))
* Support for Xamarin projects has been deprecated. While we still expect the SDK to work, we no longer actively test against Xamarin as it has been end-of-life'd by Microsoft since May. (PR [#3683](https://github.com/realm/realm-dotnet/pull/3683))
* Support for .NET 6 is deprecated. We still expect everything to work, but we'll retarget the SDK to the latest LTS version (8.0) in a future release. (PR [#3683](https://github.com/realm/realm-dotnet/pull/3683))
### Fixed
* Having a query with a number of predicates ORed together may result in a crash on some platforms (strict weak ordering check failing on iphone). (Core 14.13.0)
* Migrating primary key to a new type without migration function would cause an assertion to fail. (Core 20.1.1)
* Opening a Realm on Pixel devices running Android 14+ could result in a hardlock. (Core 20.1.2)
### Compatibility
* Realm Studio: 15.0.0 or later.
### Internal
* Using Core 20.1.2.