Releases: realm/realm-dotnet
10.0.0-beta.2 - Bug fixes
Fixed
- Fix crash in case insensitive query on indexed string columns when nothing matches (Core upgrade)
Enhancements
- Added an extra compile-time check to detect erroneous List declarations and suggest IList for collection properties in Realm objects. (Issue #2083)
- Added overloads for
Realm.Write
andRealm.WriteAsync
that can return a value. (Issue #2081)
Compatibility
- Realm Studio: 10.0.0 or later.
Internal
- Using Sync 10.1.0 and Core 10.1.0.
5.1.2 - UWP main thread fix
Fixed
- Fixed an issue that would result in
Realm accessed from incorrect thread
exception being thrown when accessing a Realm instance on the main thread in UWP apps. (Issue #2045)
Compatibility
- Realm Object Server: 3.23.1 or later.
- Realm Studio: 5.0.0 or later.
10.0.0-beta.1 Decimal, ObjectId, Embedded Objects + MongoDB Realm support
This beta release adds multiple improvements to the local database as well as support for synchronizing with MongoDB Realm Cloud. It no longer supports legacy Realm Cloud (https://cloud.realm.io), so users who haven't migrated to MongoDB Realm should not upgrade.
Breaking Changes
- We no longer support Realm Cloud (legacy), but instead the new MongoDB Realm Cloud. MongoDB Realm is a serverless platform that enables developers to quickly build applications without having to set up server infrastructure. MongoDB Realm is built on top of MongoDB Atlas, automatically integrating the connection to your database. (#2011)
- Remove support for Query-based sync, including the configuration parameters and the
SyncSubscription
types. (#2011) - Remove everything related to sync permissions, including both the path-based permission system and the object-level privileges for query-based sync. Permissions in MongoDB Realm are defined serverside. (#2011)
- Moved all API for dynamic access on the
Realm
class toRealm.DynamicApi
:Realm.CreateObject(string className, object primaryKey)
is nowRealm.DynamicApi.CreateObject(string className, object primaryKey)
.Realm.All(string className)
is nowRealm.DynamicApi.All(string className)
.Realm.RemoveAll(string className)
is nowRealm.DynamicApi.RemoveAll(string className)
.Realm.Find(string className, long? primaryKey)
is nowRealm.DynamicApi.Find(string className, long? primaryKey)
.Realm.Find(string className, string primaryKey)
is nowRealm.DynamicApi.Find(string className, string primaryKey)
.
- It is now required that all top-level objects in a synchronized Realm have a primary key called
_id
. You can use theMapTo("_id")
attribute to avoid using unidiomatic names for the model properties. - Bumped the minimum target for Xamarin.iOS apps to iOS 9.
- Bumped the minimum API level for Xamarin.Android apps to 16 (Android 4.1).
- Renamed
FullSyncConfiguration
toSyncConfiguration
.
Enhancements
-
Added support for syncing to MongoDB instead of Realm Object Server. Applications must be created at realm.mongodb.com.
-
Added an
App
class which is the entrypoint for synchronizing with a MongoDB Realm App. -
Added
User.CustomData
containing an unstructured document with additional information about the user. Custom data is configured in your MongoDB Realm App. -
Added
User.Functions
. This is the entry point for calling Remote MongoDB Realm functions. Functions allow you to define and execute server-side logic for your application. Functions are written in modern JavaScript (ES6+) and execute in a serverless manner. When you call a function, you can dynamically access components of the current application as well as information about the request to execute the function and the logged in user that sent the request. -
Added
User.GetMongoClient
exposing an API for CRUD operations on a Remote MongoDB Service. -
Added
User.GetPushClient
exposing an API for registering a device for push notifications. -
Change
SyncConfiguration
to accept partition value instead of a server Uri. Partition values can currently be of typesstring
,long
, orObjectId
. Opening a realm by partition value is the equivalent of previously opening a realm by URL. In this case, partitions are meant to be more closely associated with your data. E.g., if you are a large retailer with multiple locations, the partition key can be the store Id and you each Realm will only contain data related to the specified store. -
Add support for the Decimal128 data type. This is a 128-bit IEEE 754 decimal floating point number. Properties of this type can be declared either as
MongoDB.Bson.Decimal128
type or the built-indecimal
type. Note that .NET's built-in decimal is 96-bit, so it cannot represent the full range of numbers, representable byDecimal128
. (PR #2014) -
Add support for the
ObjectId
data type. This is a 12 byte unique identifier that is common as a document id in MongoDB databases. It can be used a primary key. (PR #2035) -
Add support for embedded objects. Embedded objects are objects which are owned by a single parent object, and are deleted when that parent object is deleted or their parent no longer references them. Embedded objects are declared by subclassing
EmbeddedObject
instead ofRealmObject
. Reassigning an embedded object is not allowed and neither is linking to it from multiple parents. Querying for embedded objects directly is also disallowed as they should be viewed as complex structures belonging to their parents as opposed to standalone objects. A trivial example is:public class Address : EmbeddedObject { public string Street { get; set; } public string City { get; set; } } public class Person : RealmObject { public string Name { get; set; } // Address is an embedded object - you reference it as usual public Address Address { get; set; } } public class Company : RealmObject { public string PhoneNumber { get; set; } // Embedded objects can be contained in lists too public IList<Address> OfficeAddresses { get; } }
-
Added new dynamic methods for instantiating embedded objects:
-
Realm.DynamicApi.CreateEmbeddedObjectForProperty
should be used to create an embedded object and assign it to a parent's property. For example:// static API var person = new Person(); person.Address = new Address { City = "New York" }; // dynamic API var dynamicPerson = realm.DynamicApi.CreateObject("Person"); var address = realm.DynamicApi.CreateEmbeddedObjectForProperty(dynamicPerson, "Address") address.City = "New York";
-
Realm.DynamicApi.AddEmbeddedObjectToList
should be used to create an embedded object and add it to a parent's list property. -
Realm.DynamicApi.InsertEmbeddedObjectInList
should be used to create an embedded object and insert it in a parent's list property at a specified index. -
Realm.DynamicApi.SetEmbeddedObjectInList
should be used to create an embedded object and set it at an index in a parent's list property.// static API var company = new Company(); company.OfficeAddresses.Add(new Address { City = "New York" }); company.OfficeAddresses.Insert(0, new Address { City = "Palo Alto" }); company.OfficeAddresses[1] = new Address { City = "New Jersey" }; // dynamic API var dynamicCompany = realm.DynamicApi.CreateObject("Company"); var officeToAdd = realm.DynamicApi.AddEmbeddedObjectToList(dynamicCompany.OfficeAddresses); officeToAdd.City = "New York"; var officeToInsert = realm.DynamicApi.InsertEmbeddedObjectInList(dynamicCompany.OfficeAddresses, 0); officeToInsert.City = "Palo Alto"; var officeToSet = realm.DynamicApi.SetEmbeddedObjectInList(dynamicCompany.OfficeAddresses, 1); officeToSet.City = "New Jersey";
-
-
The memory mapping scheme for Realm files has changed to better support opening very large files.
Compatibility
- Realm Studio: 10.0.0 or later.
5.1.1 - Bug Fixes
Fixed
- Querying on an indexed property may give a “Key not found” exception. (Core upgrade)
- Fix queries for null on non-nullable indexed integer columns returning results for zero entries. (Core upgrade)
Compatibility
- Realm Object Server: 3.23.1 or later.
- Realm Studio: 5.0.0 or later.
5.1.0 - Bug fixes and performance improvements
Enhancements
- Greatly improve performance of NOT IN queries on indexed string or int columns. (Core upgrade)
Fixed
- Fixed an issue that would cause using Realm on the main thread in WPF applications to throw an exception with a message "Realm accessed from the incorrect thread". (Issue #2026)
- Fixed an issue that could cause an exception with the message "Opening Realm files of format version 0 is not supported by this version of Realm" when opening an encrypted Realm. (Core upgrade)
- Slightly improve performance of most operations which read data from the Realm file. (Core upgrade)
- Rerunning an equals query on an indexed string column which previously had more than one match and now has one match would sometimes throw a "key not found" exception. (Core upgrade)
- When querying a table where links are part of the condition, the application may crash if objects has recently been added to the target table. (Core upgrade)
Compatibility
- Realm Object Server: 3.23.1 or later.
- Realm Studio: 5.0.0 or later.
5.0.1 - Upgraded Core
NOTE: This version bumps the Realm file format to version 11. It is not possible to downgrade to version 10 or earlier. Files created with older versions of Realm will be automatically upgraded. Only Realm Studio 5.0.0 or later will be able to open the new file format.
Enhancements
- Added the notion of "frozen objects" - these are objects, queries, lists, or Realms that have been "frozen" at a specific version. This allows you to access the data from any thread, but it will never change. All frozen objects can be accessed and queried as normal, but attempting to mutate them or add change listeners will throw an exception. (Issue #1945)
- Added
Realm.Freeze()
,RealmObject.Freeze()
,RealmObject.FreezeInPlace()
,IQueryable<RealmObject>.Freeze()
,IList<T>.Freeze()
, andIRealmCollection<T>.Freeze()
. These methods will produce the frozen version of the instance on which they are called. - Added
Realm.IsFrozen
,RealmObject.IsFrozen
, andIRealmCollection<T>.IsFrozen
, which returns whether or not the data is frozen. - Added
RealmConfigurationBase.MaxNumberOfActiveVersions
. Setting this will cause Realm to throw an exception if too many versions of the Realm data are live at the same time. Having too many versions can dramatically increase the filesize of the Realm.
- Added
- Add support for
SynchronizationContext
-confined Realms. Rather than being bound to a specific thread, queue-confined Realms are bound to aSynchronizationContext
, regardless of whether it dispatches work on the same or a different thread. Opening a Realm whenSynchronizationContext.Current
is null - most notablyTask.Run(...)
- will still confine the Realm to the thread on which it was opened. - Storing large binary blobs in Realm files no longer forces the file to be at least 8x the size of the largest blob.
- Reduce the size of transaction logs stored inside the Realm file, reducing file size growth from large transactions.
- String primary keys no longer require a separate index, improving insertion and deletion performance without hurting lookup performance.
Fixed
- Fixed
Access to invalidated List object
being thrown when adding objects to a list while at the same time deleting the object containing the list. (Issue #1971) - Fixed incorrect results being returned when using
.ElementAt()
on a query where a string filter with a sort clause was applied. (PR #2002)
Compatibility
- Realm Object Server: 3.23.1 or later.
Internal
- Using Sync 5.0.22 and Core 6.0.25.
4.3.0 - Maintenance update
Enhancements
- Exposed an API to configure the
userId
andisAdmin
of a user when creating credentials viaCredentials.CustomRefreshToken
. Previously these values would be inferred from the JWT itself but as there's no way to enforce the server configuration over which fields in the JWT payload represent theuserId
and theisAdmin
field, it is now up to the consumer to determine the values for these. - Improved logging and error handling for SSL issues on Apple platforms.
Fixed
- Realm objects can now be correctly serialized with
System.Runtime.Serialization.Formatters
andSystem.Xml.Serialization
serializers. (Issue #1913)
The private state fields of the class have been decorated with[NonSerialized]
and[XmlIgnore]
attributes so that eager opt-out
serializers do not attempt to serialize fields such asRealm
andObjectSchema
which contain handles to unmanaged data. - Fixed an issue that would result in a compile error when
[Required]
is applied onIList<string>
property. (Contributed by braudabaugh) - Fixed an issue that prevented projects that include the Realm NuGet package from being debugged. (PR #1927)
- The sync client would fail to reconnect after failing to integrate a changeset. The bug would lead to further corruption of the client’s Realm file. (since 3.0.0).
- The string-based query parser (
results.Filter(...)
) used to need theclass_
prefix for class names when querying over backlink properties. This has been fixed so that only the publicObjectSchema
name is necessary. For example,@links.class_Person.Siblings
becomes@links.Person.Siblings
. - Fixed an issue where
ClientResyncMode.DiscardLocalRealm
wouldn't reset the schema.
Compatibility
- Realm Object Server: 3.23.1 or later.
Internal
- Upgraded Sync from 4.7.5 to 4.9.5 and Core from 5.23.3 to 5.23.8.
4.2.0 - Improved GetInstanceAsync
Enhancements
- Added
int IndexOf(object)
andbool Contains(object)
to theIRealmCollection
interface. (PR #1893) - Exposed an API -
SyncConfigurationBase.EnableSessionMultiplexing()
that allows toggling session multiplexing on the sync client. (PR 1896) - Added support for faster initial downloads when using
Realm.GetInstanceAsync
. (Issue 1847) - Added an optional
cancellationToken
argument toRealm.GetInstanceAsync
enabling clean cancelation of the in-progress download. (PR 1859) - Added support for Client Resync which automatically will recover the local Realm in case the server is rolled back. This largely replaces the Client Reset mechanism for fully synchronized Realms. Can be configured using
FullSyncConfiguration.ClientResyncMode
. (PR #1901) - Made the
createUser
argument inCredentials.UsernamePassword
optional. If not specified, the user will be created or logged in if they already exist. (PR #1901) - Uses Fody 6.0.0, which resolves some of the compatibility issues with newer versions of other Fody-based projects. (Issue #1899)
Fixed
- Fixed an infinite recursion when calling
RealmCollectionBase<T>.IndexOf
. (Issue #1892)
Compatibility
- Realm Object Server: 3.23.1 or later.
Internal
- Upgraded Sync from 4.7.0 to 4.7.1.
- Implemented direct access to sync workers on Cloud, bypassing the Sync Proxy: the binding will override the sync session's url prefix if the token refresh response for a realm contains a sync worker path field.
4.1.0 - Core Upgrade and Custom Refresh Tokens
Breaking Changes
- Removed the
isAdmin
parameter fromCredentials.Nickname
. It doesn't have any effect on new ROS versions anyway as logging in an admin nickname user is not supported - this change just makes it explicit. (Issue #1879) - Marked the
Credentials.Nickname
method as deprecated - support for the Nickname auth provider is deprecated in ROS and will be removed in a future version. (Issue #1879) - Removed the
deleteRealm
parameter fromPermissionDeniedException.DeleteRealmInfo
as passingfalse
has no effect. Calling the method is now equivalent to calling it withdeleteRealm: true
. (PR #1890)
Enhancements
- Added support for unicode characters in realm path and filenames for Windows. (Core upgrade)
- Added new credentials type:
Credentials.CustomRefreshToken
that can be used to create a user with a custom refresh token. This will then be validated by ROS against the configuredrefreshTokenValidators
to obtain access tokens when opening a Realm. If creating a user like that, it's the developer's responsibility to ensure that the token is valid and refreshed as necessary to ensure that access tokens can be obtained. To that end, you can now set the refresh token of a user object by callingUser.RefreshToken = "my-new-token"
. This should only be used in combination with users obtained by callingCredentials.CustomRefreshToken
. (PR #1889)
Fixed
- Constructing an IncludeDescriptor made unnecessary table comparisons. This resulted in poor performance when creating a query-based subscription (
Subscription.Subscribe
) withincludedBacklinks
. (Core upgrade) - Queries involving an indexed int column which were constrained by a LinkList with an order different from the table's order would give incorrect results. (Core upgrade)
- Queries involving an indexed int column had a memory leak if run multiple times. (Core upgrade)
Compatibility
- Realm Object Server: 3.23.1 or later.
4.0.1 - iOS fixes
Fixed
-
Fixed an issue that would prevent iOS apps from being published to the app store with the following error:
This bundle Payload/.../Frameworks/realm-wrappers.framework is invalid. The Info.plist file is missing the required key: CFBundleVersion.
(Issue 1870, since 4.0.0)
-
Fixed an issue that would cause iOS apps to crash on device upon launching. (Issue 1871, since 4.0.0)