Skip to content

2.0.0 - Sync for Windows, partial sync, lists of primitives

Compare
Choose a tag to compare
@nirinchev nirinchev released this 17 Oct 11:25

This is a major release that includes numerous improvements as well as several highly requested new features. This release is incompatible with the Realm Object Server 1.x series. Comprehensive documentation on migrating an app that uses synchronized Realms from 1.x to 2.x will be published shortly. Apps that are using offline realms only are not affected and can upgrade safely.

  • We're releasing sync for Windows (UWP, .NET Core, and classic desktop) as beta. It has a few rough edges, but we believe it's stable enough to start experimenting with and use it in your development workflow. The stable release of Sync for Windows is expected later this month.
  • Partial Sync is released as a technical preview and not meant to be used in production. It allows you to specify a query and only objects matching that query will be downloaded by the Realm Object Server. The API is very much work in progress and we expect to change it to something more idiomatic for .NET at a later point. A stable release of Partial Sync is expected early next year.
  • We have dropped the constraints of persisted IList<T> properties and you can now specify primitive values as well as RealmObject subtypes.

Below is the full list of changes and enhancements.

Enhancements

  • Added support for collections of primitive values. You can now define properties as IList<T> where T can be any
    type supported by Realm, except for another IList. As a result, a lot of methods that previously had constraints on
    RealmObject now accept any type and may throw a runtime exception if used with an unsupported type argument.
    (#1517)
  • Added HelpLink pointing to the relevant section of the documentation to most Realm exceptions. (#1521)
  • Added RealmObject.GetBacklinks API to dynamically obtain all objects referencing the current one. (#1533)
  • Added a new exception type, PermissionDeniedException, to denote permission denied errors when working with synchronized Realms that
    exposes a method - DeleteRealmUserInfo - to inform the binding that the offending Realm's files should be kept or deleted immediately.
    This allows recovering from permission denied errors in a more robust manner. (#1543)
  • The keychain service name used by Realm to manage the encryption keys for sync-related metadata on Apple platforms is now set to the
    bundle identifier. Keys that were previously stored within the Realm-specific keychain service will be transparently migrated to the
    per-application keychain service. (#1522)
  • Added a new exception type - IncompatibleSyncedFileException - that allows you to handle and perform data migration from a legacy (1.x) Realm file
    to the new 2.x format. It can be thrown when using Realm.GetInstance or Realm.GetInstanceAsync and exposes a GetBackupRealmConfig method
    that allows you to open the old Realm file in a dynamic mode and migrate any required data. (#1552)
  • Enable encryption on Windows. (#1570)
  • Enable Realm compaction on Windows. (#1571)
  • UserInfo has been significantly enhanced. It now contains metadata about a user stored on the Realm Object Server, as well as a list of all user
    account data associated with that user. (#1573)
  • Introduced a new method - User.LogOutAsync to replace the now-deprecated synchronous call. (#1574)
  • Exposed BacklinksCount property on RealmObject that returns the number of objects that refer to the current object via a to-one or a to-many relationship. (#1578)
  • String primary keys now support null as a value. (#1579)
  • Add preview support for partial synchronization. Partial synchronization allows a synchronized Realm to be opened in such a way
    that only objects requested by the user are synchronized to the device. You can use it by setting the IsPartial property on a
    SyncConfiguration, opening the Realm, and then calling Realm.SubscribeToObjectsAsync with the type of object you're interested in,
    a string containing a query determining which objects you want to subscribe to, and a callback which will report the results. You may
    add as many subscriptions to a synced Realm as necessary. (#1580)
  • Ensure that Realm collections (IList<T>, IQueryable<T>) will not change when iterating in a foreach loop. (#1589)

Bug fixes

  • Realm.GetInstance will now advance the Realm to the latest version, so you no longer have to call Refresh manually after that. (#1523)
  • Fixed an issue that would prevent iOS Share Extension projects from working. (#1535)

Breaking Changes

  • This release requires Realm Object Server 2.x.
  • Realm.CreateObject(string className) now has additional parameter object primaryKey. You must pass that when creating a new object using the dynamic API. If the object you're creating doesn't have primary key declared, pass null. (#1381)
  • AcceptPermissionOfferAsync now returns the relative rather than the absolute url of the Realm the user has been granted permissions to. (#1595)