realm-dotnet

Realm is a mobile database: a replacement for SQLite & ORMs

APACHE-2.0 License

Downloads
7.5K
Stars
1.2K
Committers
50

Bot releases are hidden (Show)

realm-dotnet - 10.2.1 - New Unity package format

Published by nirinchev over 3 years ago

This release changes the way Unity binaries are packaged and obviates the need to have an extra Unity package that contains the dependencies as standalone modules. If you were using the io.realm.unity-bundled package, please remove it and add the newly released io.realm.unity one.

Fixed

  • [Unity] Fixed an issue where failing to weave an assembly due to modeling errors, would only show an error in the logs once and then fail opening a Realm with No RealmObjects. Has linker stripped them?. Now, the weaving errors will show up on every code change/weave attempt and the runtime error will explicitly suggest manually re-running the weaver. (Issue #2310)
  • [Unity] Fixed an issue that would cause the app to hang on exit when using Sync. (PR #2467)
  • [Unity] Fixed an issue that would cause the Unity editor on macOS to hang after assembly reload if the app uses Sync. (Issue #2482)
  • Fixed an issue where a crash could happen on Android x86 due to converting UInt32 into TableKey and Int64 into ObjKey incorrectly. (Issue #2456)

Compatibility

  • Realm Studio: 11.0.0 or later.
realm-dotnet - 10.2.0 - New datatypes and Unity improvements

Published by nirinchev over 3 years ago

This release adds SDK support for four new datatatypes - Guid, RealmValue, ISet<TValue>, and IDictionary<string, TValue>.

NOTE: This version upgrades the Realm file format version to add support for the new data types and to adjust how primary keys are handled. Realm files opened will be automatically upgraded and cannot be read by versions older than v10.2.0. This upgrade should be a fairly fast one. Note that we now automatically create a backup of the pre-upgrade Realm.

Enhancements

  • Add support for the Guid data type. It can be used as primary key and is indexable. (PR #2120)

  • Add support for dictionaries. Currently only string keys are supported, while the value type may be any of the supported types (the primitive types, RealmValue, or custom types that inherit from RealmObject/EmbeddedObject). Lists, sets, or other dictionaries may not be used as the value type. To add a dictionary to your model, define a getter-only property of type IDictionary<string, T>:

    public class MyObject : RealmObject
    {
        public IDictionary<string, decimal> Denominations { get; }
    }
    
    // Realm will automatically manage the underlying dictionary, so there's no need
    // to define a constructor  or assign it to some value.
    
    var obj = new MyObject();
    obj.Denominations.Add("quarter", 0.25d);
    
  • Add support for RealmValue data type. This new type can represent any valid Realm data type, including objects. Collections (lists, sets and dictionaries) of RealmValue are also supported, but RealmValue itself cannot contain collections. Please note that a property of type RealmValue cannot be nullable, but can contain null, represented by the value RealmValue.Null. (PR #2252)

    public class MyObject : RealmObject
    {
        public RealmValue MyValue { get; set; }
    
        public IList<RealmValue> ValuesList { get; }
    
        public ISet<RealmValue> ValuesSet { get; }
    
        public IDictionary<string, RealmValue> ValuesDict { get; }
    }
    
    var obj = new MyObject();
    obj.MyValue = RealmValue.Null;
    obj.MyValue = 1;
    obj.MyValue = "abc";
    
    if (obj.MyValue.Type == RealmValueType.String)
    {
        var myString = obj.MyValue.AsString();
    }
    
  • Add support for sets of objects or primitive values. Sets are unordered collections that ensure uniqueness of their elements. Realm uses its internal equality comparer and it is not possible to customize its behavior by overriding Equals or GetHashCode on your custom classes. Objects will always be compared by db reference - i.e. two distinct objects in the database will always be different, even if their contents are identical, and multiple references to the same database object will always be equal.

    public class MyObject : RealmObject
    {
        public ISet<string> UniqueStrings { get; }
    }
    
    // Realm will automatically manage the underlying set, so there's no need
    // to define a constructor  or assign it to some value.
    
    var obj = new MyObject();
    var didAdd = obj.UniqueStrings.Add("foo"); // true
    didAdd = obj.UniqueStrings.Add("foo"); // false
    
  • Added support for value substitution in string based queries. This enables expressions following this syntax: realm.All<T>().Filter("field1 = $0 && field2 = $1", 123, "some-string-value"). (Issue #1822)

  • Reduced the size of the native binaries by ~5%. (PR #2239)

  • Added a new class - Logger, which allows you to override the default logger implementation (previously writing to stdout or stderr) with a custom one by setting Logger.Default. This replaces AppConfiguration.CustomLogger and AppConfiguration.LogLevel which will be removed in a future release. The built-in implementations are:

    • Console - uses the System.Console for most projects and UnityEngine.Debug for Unity projects: Logger.Default = Logger.Console;
    • Null - ignores all messages: Logger.Default = Logger.Null;
    • Function - proxies calls to a supplied function: Logger.Default = Logger.Function(message => myExternalLogger.Log(message));

    Custom loggers can derive from the Logger class and provide their own implementation for the Log method or use Function and provide an Action<string>. (PR #2276)

  • RealmObjectBase now correctly overrides and implements GetHashCode(). (Issue #1650)

  • Added an override of RealmObject.ToString() to output more meaningful information about the object content. It will output the type of the object, the primary key (if one is defined), as well as information whether the object is managed or deleted. (Issue #2347)

  • Added new API for dynamically accessing object properties. These are designed to support ahead-of-time compiled platforms, such as Xamarin.iOS and Unity with IL2CPP compilation. The
    intention is to eventually make these the default API, while also supporting the legacy DLR-based API. Example:

    // Make sure to cast away the dynamic immediately on AOT platforms.
    var people = (IQueryable<RealmObject>)realm.DynamicApi.All("Person");
    foreach (var person in people)
    {
        var firstName = person.DynamicApi.Get<string>("FirstName");
        var address = person.DynamicApi.Get<EmbeddedObject>("Address");
        var city = address.DynamicApi.Get<string>("City");
    }
    
    // When casting a dynamic object, always cast first to object and then
    // to the actual object type to remove any callsites being generated.
    var newPerson = (RealmObject)(object)realm.DynamicApi.Create("Person", 123);
    newPerson.DynamicApi.Set("FirstName", "Peter");
    
  • Added a Unity Editor option to enable weaving editor assemblies. This should be "off" unless your project has Editor assemblies that reference Realm - for example, an EditMode test assembly that tests Realm-related functionality. Keeping it "on" may slow down builds a little as more assemblies will need to be evaluated for weaving. (Issue #2346)

  • We now make a backup of the realm file prior to any file format upgrade. The backup is retained for 3 months. Backups from before a file format upgrade allows for better analysis of any upgrade failure. We also restore a backup, if a) an attempt is made to open a realm file whith a "future" file format and b) a backup file exist that fits the current file format. (#4166)

Fixed

  • Fixed a bug where applying multiple OrderBy clauses on a query would result in the clauses being appended to each other as if they were .ThenBy rather than the last clause replacing the preceding ones. (PR #2255)
  • When explicitly specifying SyncConfiguration.ObjectTypes, added a check to validate the schema and ensure all EmbeddedObject classes are reachable from a class inheriting from RealmObject. More info about this subject can be found here. (PR #2259)
  • Fixed a bug that would result in an error similar to Undefined symbols for architecture xxx: "_realm_thread_safe_reference_destroy" when building a Unity project for iOS. (Issue #2318)
  • The weaver will now emit an error if you try to define a collection of RealmInteger values. This has never been supported, but previously it would fail silently whereas now it'll be a compile time error. (Issue #2308)
  • Fixed an issue where using collections of managed objects (lists or results) in a Unity project would result in an invalid compiled binary. (PR #2340)
  • Fixed a memory leak when a migration callback is defined, but the Realm didn't actually need to run it (PR #2331)
  • Added back 32bit support for iOS builds. (Issue #2429)
  • Removed redundant warnings when building a Unity project for device that mentioned that the schema for Realm and Realm.UnityUtils is empty. (Issue #2320)
  • Fixed an issue that could cause NullReferenceException to be thrown if you set SyncConfiguration.OnProgress to null shortly after calling Realm.GetInstanceAsync(syncConfig). (Issue #2400)
  • When replacing an embedded object, emit a sync instruction that sets the link to the embedded object to null so that it is properly cleared. This resolves an issue that would have manifested itself as Failed to parse, or apply received changeset: ERROR: ArrayInsert: Invalid prior_size (list size = 4, prior_size = 0) (Issue #4740
  • Made Linux implementation of ExternalCommitHelper work with new versions of Linux that changed epoll behavior, including Android 12 (Issue #4666)
  • The file format is changed in the way that we now - again - have search indexes on primary key columns. This is required as we now stop deriving the ObjKeys from the primary key values, but just use an increasing counter value. This has the effect that all new objects will be created in the same cluster and not be spread out as they would have been before. It also means that upgrading from file format version 11 and earlier formats will be much faster. (Core upgrade)

Compatibility

  • Realm Studio: 11.0.0-alpha.0 or later.

Unity support

The Unity packages are very early previews and are considered unstable. We do not recommend using them in production because issues are expected.

realm-dotnet - 10.1.4 - Bug fixes

Published by nirinchev over 3 years ago

Fixed

  • Fixed a bug that could lead to crashes with a message similar to Invalid ref translation entry [0, 78187493520]. (Core upgrade)
  • Fix assertion failures such as !m_notifier_skip_version.version or m_notifier_sg->get_version() + 1 == new_version.version when performing writes inside change notification callbacks. (Core upgrade)
  • Fix collection notification reporting for modifications. This could be observed by receiving the wrong indices of modifications on sorted or distinct results, or notification blocks sometimes not being called when only modifications have occurred. (Core upgrade)
  • Proactively check the expiry time on the access token and refresh it before attempting to initiate a sync session. This prevents some error logs from appearing on the client such as: ERROR: Connection[1]: Websocket: Expected HTTP response 101 Switching Protocols, but received: HTTP/1.1 401 Unauthorized. (Core upgrade)
  • Destruction of the TableRecycler at exit was unordered compared to other threads running. This could lead to crashes, some with the TableRecycler at the top of the stack. (Core upgrade)
  • Fixed errors related to uncaught exception in notifier thread: N5realm11KeyNotFoundE: No such object. This could happen in a synchronized app when a linked object was deleted by another client. (Core upgrade)
  • Opening a metadata realm with the wrong encryption key or different encryption configuration will remove that metadata realm and create a new metadata realm using the new key or configuration. (Core upgrade)
  • Creating a ThreadSafeReference to a readonly Realm would result in a crash. (Core upgrade)

Unity support

The Unity packages are very early previews and are considered unstable. We do not recommend using them in production because issues are expected, especially when compiling with IL2CPP.

realm-dotnet - 10.2.0-beta.2 - Bug fixes

Published by papafe over 3 years ago

Fixed

  • Fixed a bug that would result in an error similar to Undefined symbols for architecture xxx: "_realm_thread_safe_reference_destroy" when building a Unity project for iOS. (Issue #2318)
  • The weaver will now emit an error if you try to define a collection of RealmInteger values. This has never been supported, but previously it would fail silently whereas now it'll be a compile time error. (Issue #2308)
  • Fixed an issue where using collections of managed objects (lists or results) in a Unity project would result in an invalid compiled binary. (PR #2340)
  • Fixed a memory leak when a migration callback is defined, but the Realm didn't actually need to run it (PR #2331)

Enhancements

  • Added an override of RealmObject.ToString() to output more meaningful information about the object content. It will output the type of the object, the primary key (if one is defined), as well as information whether the object is managed or deleted. (Issue #2347)

Unity support

The Unity packages are very early previews and are considered unstable. We do not recommend using them in production because issues are expected, especially when compiling with IL2CPP.

realm-dotnet - 10.1.3 - Bug fixes

Published by papafe over 3 years ago

Fixed

  • Fixed a compiler bug that would result in an "Access violation" error being thrown when using sync on Windows.

Unity support

The Unity packages are very early previews and are considered unstable. We do not recommend using them in production because issues are expected, especially when compiling with IL2CPP.

realm-dotnet - 10.2.0-beta.1 - Guid, Set, Dictionary, and RealmValue support

Published by nirinchev over 3 years ago

This beta release introduces support for 4 new datatypes - Guid, ISet<T>, IDictionary<string, T>, and RealmValue. It also includes multiple bug fixes for our Unity packages, so if you're alpha testing the Unity releases, it is strongly recommended that you upgrade to this version.

Downgrade considerations

Downgrading to an earlier version of the Realm SDK is not supported, so it is strongly recommended that you do not publish production apps using beta versions of the SDK.

Compatibility

This release is incompatible with Stable versions of Realm Studio. A compatible beta version of Realm Studio is coming soon.

Unity

Unity binaries are provided with this release as a very early preview. We don't officially support Unity as a platform yet, so it is expected that there are bugs and missing functionality.

Fixed

  • Fixed an issue that would result in UWP apps being rejected from the Microsoft Store due to an unsupported API (__C_specific_handler) being used. (Issue #2235)
  • Fixed a bug where applying multiple OrderBy clauses on a query would result in the clauses being appended to each other as if they were .ThenBy rather than the last clause replacing the preceding ones. (PR #2255)
  • When explicitly specifying SyncConfiguration.ObjectTypes, added a check to validate the schema and ensure all EmbeddedObject classes are reachable from a class inheriting from RealmObject. More info about this subject can be found here. (PR #2259)

Enhancements

  • Add support for the Guid data type. It can be used as primary key and is indexable. (PR #2120)

  • Add support for dictionaries. Currently only string keys are supported, while the value
    type may be any of the supported types (the primitive types or custom types that inherit
    from RealmObject/EmbeddedObject). Lists, sets, or other dictionaries may not be used as
    the value type. To add a dictionary to your model, define a getter-only property of type
    IDictionary<string, T>:

    public class MyObject : RealmObject
    {
        public IDictionary<string, decimal> Denominations { get; }
    }
    
    // Realm will automatically manage the underlying dictionary, so there's no need
    // to define a constructor  or assign it to some value.
    
    var obj = new MyObject();
    obj.Denominations.Add("quarter", 0.25d);
    
  • Add support for RealmValue data type. This new type can represent any valid Realm data type, including objects. Collections (lists, sets and dictionaries) of RealmValue are also supported, but 'RealmValue' cannot contain collections. Please note that a property of type RealmValue cannot be nullable, but can contain null, represented by the value RealmValue.Null. (PR #2252)

    public class MyObject : RealmObject
    {
        public RealmValue MyValue { get; set; }
    
        public IList<RealmValue> ValuesList { get; }
    
        public ISet<RealmValue> ValuesSet { get; }
    
        public IDictionary<string, RealmValue> ValuesDict { get; }
    }
    
    var obj = new MyObject();
    obj.MyValue = RealmValue.Null;
    obj.MyValue = 1;
    obj.MyValue = "abc";
    
    if (obj.Type == RealmValueType.String)
    {
        var myString = obj.MyValue.AsString();
    }
    
  • Add support for sets of objects or primitive values. Sets are unordered collections that ensure uniqueness of their elements. Realm uses its internal equality comparer
    and it is not possible to customize its behavior by overriding Equals or GetHashCode on your custom classes. Objects will always be compared by db reference - i.e.
    two distinct objects in the database will always be different, even if their contents are identical, and multiple references to the same database object will always be
    equal.

    public class MyObject : RealmObject
    {
        public ISet<string> UniqueStrings { get; }
    }
    
    // Realm will automatically manage the underlying set, so there's no need
    // to define a constructor  or assign it to some value.
    
    var obj = new MyObject();
    var didAdd = obj.UniqueStrings.Add("foo"); // true
    didAdd = obj.UniqueStrings.Add("foo"); // false
    
  • Added support for value substitution in string based queries. This enables expressions following this syntax: realm.All<T>().Filter("field1 = $0 && field2 = $1", 123, "some-string-value"). (Issue #1822)

  • Reduced the size of the native binaries by ~5%. (PR #2239)

  • Added a new class - Logger, which allows you to override the default logger implementation (previously writing to stdout or stderr) with a custom one by setting
    Logger.Default. This replaces AppConfiguration.CustomLogger and AppConfiguration.LogLevel which will be removed in a future release. The built-in implementations are:

    • Console - uses the System.Console for most projects and UnityEngine.Debug for Unity projects: Logger.Default = Logger.Console;
    • Null - ignores all messages: Logger.Default = Logger.Null;
    • Function - proxies calls to a supplied function: Logger.Default = Logger.Function(message => myExternalLogger.Log(message));

    Custom loggers can derive from the Logger class and provide their own implementation for the Log method or use Function and provide an Action<string>. (PR #2276)

  • RealmObjectBase now correctly overrides and implements GetHashCode(). (Issue #1650)

Unity support

The Unity packages are very early previews and are considered unstable. We do not recommend using them in production because issues are expected, especially when compiling with IL2CPP.

realm-dotnet - 10.1.2 - Bug fixes

Published by nirinchev over 3 years ago

Fixed

  • On 32bit devices you may get exception with "No such object" when upgrading to v10. (Core upgrade)
  • The notification worker thread would rerun queries after every commit rather than only commits which modified tables which could affect the query results if the table had any outgoing links to tables not used in the query. (Core upgrade)
  • Fix "Invalid ref translation entry [16045690984833335023, 78187493520]" assertion failure which could occur when using sync or multiple processes writing to a single Realm file. (Core upgrade)
  • During integration of a large amount of data from the server, you may get "Assertion failed: !fields.has_missing_parent_update()". (Core upgrade)
  • Syncing large Decimal128 values will cause "Assertion failed: cx.w[1] == 0". (Core upgrade)
  • Avoid race condition leading to possible hangs on windows. (Core upgrade)

Unity support

The Unity packages are very early previews and are considered unstable. We do not recommend using them in production because issues are expected, especially when compiling with IL2CPP.

realm-dotnet - 10.1.1 - Bug fixes

Published by nirinchev over 3 years ago

Fixed

  • Fixed an issue that would result in UWP apps being rejected from the Microsoft Store due to an unsupported API (__C_specific_handler) being used. (Issue #2235)
  • The Realm notification listener thread could sometimes hit the assertion failure "!skip_version.version" if a write transaction was committed at a very specific time. (Core upgrade)

Unity support

The Unity packages are very early previews and are considered unstable. We do not recommend using them in production because issues are expected, especially when compiling with IL2CPP.

realm-dotnet - 5.1.3 - Bug fixes

Published by nirinchev over 3 years ago

Fixed

  • If you make a case insensitive query on an indexed string column, it may fail in a way that results in a "No such key" exception. (Core upgrade)
  • Fix crash in case insensitive query on indexed string columns when nothing matches. (Core upgrade)
  • Files upgraded on 32-bit devices could end up being inconsistent resulting in "Key not found" exception to be thown. (Core upgrade)
  • Fixed an issue where creating an object after file format upgrade may fail with assertion Assertion failed: lo() <= std::numeric_limits<uint32_t>::max(). (Core upgrade)

Compatibility

  • Realm Object Server: 3.23.1 or later.
realm-dotnet - 10.1.0 - Bug fixes

Published by LaPeste over 3 years ago

Enhancements

  • Sync client now logs error messages received from server rather than just the size of the error message. (Core upgrade)
  • Errors returned from the server when sync WebSockets get closed are now captured and surfaced as a SyncError. (Core upgrade)
  • Dramatically improved performance of sequential reads on a query without a filter. (Core upgrade)

Fixed

  • Fix an issue when using a frozen query across threads with different transaction versions which resulted in being able to access objects from a future version in the frozen collection. (Core upgrade)
  • Fixed an issue where creating an object after file format upgrade may fail with assertion "Assertion failed: lo() <= std::numeric_limits<uint32_t>::max()" (Core upgrade)
  • Fixed an issue where getting an element from a query result without a filter would give incorrect results if a new object was created at index zero in the source Table. (Core upgrade)
  • Fixed an issue where during synchronization the app would crash with Assertion failed: ref + size <= next->first. (Core upgrade)

Compatibility

  • Realm Studio: 10.0.0 or later.
realm-dotnet - 10.0.1 - Decimal, ObjectId, Embedded Objects + MongoDB Realm support

Published by nirinchev over 3 years ago

This is the first stable release from the v10 line of releases - the changelog includes all changes introduced between 10.0.0-beta.1 through beta.6. It adds multiple improvements to the local database as well as support for synchronizing with MongoDB Realm Cloud (https://realm.mongodb.com). 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 to Realm.DynamicApi:
    • Realm.CreateObject(string className, object primaryKey) is now Realm.DynamicApi.CreateObject(string className, object primaryKey).
    • Realm.All(string className) is now Realm.DynamicApi.All(string className).
    • Realm.RemoveAll(string className) is now Realm.DynamicApi.RemoveAll(string className).
    • Realm.Find(string className, long? primaryKey) is now Realm.DynamicApi.Find(string className, long? primaryKey).
    • Realm.Find(string className, string primaryKey) is now Realm.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 the MapTo("_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 to SyncConfiguration.
  • Removed RealmObject.FreezeInPlace. To freeze a realm object use the Freeze extension method. (Issue #2180)

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 types string, long, or ObjectId. 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-in decimal type. Note that .NET's built-in decimal is 96-bit, so it cannot represent the full range of numbers, representable by Decimal128. (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 as 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 of RealmObject. 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.

  • Replaced the implementation of the string query parser (the one used for realm.All().Filter("some-string-query")). This results in ~5% reduction of the size of the native binary while keeping the query execution times on par with the old parser. (PR #2185, Core upgrade)

  • Optimized the internal code that handles conversions between types. This should result in a minor performance increase
    for most data operations that should be most noticeable on Ahead-of-Time compiled platforms, such as iOS/UWP. Due to the
    nature of the change, it's possible that conversions that previously happened automatically when working with dynamic objects
    no longer do. If you encounter a NotSupportedException with the message No conversion exists from *type A* to *type B*
    and believe this is a bug, please open a Github Issue. (PR #2149)

  • 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 and Realm.WriteAsync that can return a value. (Issue #2081)

Fixed

  • Worked around an issue with the .NET Native compiler (used in UWP projects) that would result in the following exception being thrown in Release: Incompatible MarshalAs detected in parameter named 'value'. Please refer to MCG's warning message for more information.. (Issue #2169)
  • Fixed a bug that could cause incorrect property values to be read during a migration for apps running on .NET Core 3.0 or newer.
    The issue manifests itself when different classes have persisted properties with the same name and could result in
    the wrong property being accessed - e.g. foo.Name could return foo.Bar. This could only happen when using the
    dynamic API during a migration and does not affect apps that use the strongly typed API or run on platforms other
    than .NET Core 3.x/.NET 5.
  • Fixed a bug that could cause a deadlock in a multiprocess scenario where multiple processes share the same Realm file and listen for notifications from the file. (Core upgrade)
  • Fixed an issue with deleting and recreating objects with embedded objects. (Core upgrade)
  • Fix a race condition which would lead to "uncaught exception in notifier thread: N5realm15InvalidTableRefE: transaction_ended" and a crash when the source Realm was closed or invalidated at a very specific time during the first run of a collection notifier (Core upgrade)
  • Fix crash in case insensitive query on indexed string columns when nothing matches (Core upgrade)

Compatibility

  • Realm Studio: 10.0.0 or later.
realm-dotnet - 10.0.0-beta.6 - Fix for date regression from beta.5

Published by nirinchev over 3 years ago

Fixed

  • Fixed a regression in 10.0.0-beta.5 that incorrectly stores and retrieves DateTimeOffset values. (PR #2200)

Compatibility

  • Realm Studio: 10.0.0 or later.
realm-dotnet - [Don't use!] 10.0.0-beta.5 - Sync SSL fix + Windows multiprocess support

Published by nirinchev almost 4 years ago

Don't use this version

This version has a serious regression related to reading and writing date properties. It stores dates in an incorrect format at the database layer, which means that values written in earlier versions will be read incorrectly (typically values very close to 0000-01-01) and values written with this version will be read incorrectly with future versions.

Description

This is primarily a bug fix release that addresses an SSL regression in beta.3 and fixes a long standing bug with multiprocess support on Windows. There is no public beta.4 release, so beta.5 follows immediately after beta.3.

Breaking Changes

  • Removed RealmObject.FreezeInPlace. To freeze a realm object use the Freeze extension method. (Issue #2180)

Fixed

  • Worked around an issue with the .NET Native compiler (used in UWP projects) that would result in the following exception being thrown in Release: Incompatible MarshalAs detected in parameter named 'value'. Please refer to MCG's warning message for more information.. (Issue #2169)
  • Fixed a bug that could cause a deadlock in a multiprocess scenario where multiple processes share the same Realm file and listen for notifications from the file. (Core upgrade)
  • Fixed an issue where Sync connections would fail on Windows due to SSL server certificate rejected. (Core upgrade)
  • Fixed an issue with deleting and recreating objects with embedded objects. (Core upgrade)
  • Fix a race condition which would lead to "uncaught exception in notifier thread: N5realm15InvalidTableRefE: transaction_ended" and a crash when the source Realm was closed or invalidated at a very specific time during the first run of a collection notifier (Core upgrade)

Enhancements

  • Replaced the implementation of the string query parser (the one used for realm.All().Filter("some-string-query")). This results in ~5% reduction of the size of the native binary while keeping the query execution times on par with the old parser. (PR #2185, Core upgrade)

Unity

Starting with beta.5, we're publishing very early prerelease bundles of a Unity-compatible package. These are in no way supported and we strongly advise against using them in production. That being said, we will respond to and address issues and plan to ship fully-fledged and supported Unity package at a later point.

To install the Unity package, open the Unity Package Manager and select the Add package from tarball option. The two packages we publish are:

  • realm.unity-*version*.tgz: this package contains the Realm precompiled .dll as well as all the native binaries for all platforms. It doesn't include any of the managed dependencies, such as MongoDB.Bson or Remotion.Linq. It's up to the developer to satisfy those dependencies with versions equal to or newer than the versions listed on NuGet (Note that Fody and Realm.Fody are not dependencies of the Unity package and don't need to be installed).
  • realm.unity.bundle-*version*.tgz: this package contains everything in the first one + all the managed dependencies at their correct versions. This is the easiest package to get started with, but may introduce conflicts in case your project already bundles a dependency that Realm brings in, such as System.Buffers or MongoDB.Bson.
realm-dotnet - 10.0.0-beta.3 - Bug fixes

Published by nirinchev almost 4 years ago

Breaking Changes

  • Credentials.Google(string) now has an additional argument of type GoogleCredentialType. The available types are IdToken and AuthCode and specify what type of credential the passed string represents.

Fixed

  • Fixed a bug that could cause incorrect property values to be read during a migration for apps running on .NET Core 3.0 or newer. The issue manifests itself when different classes have persisted properties with the same name and could result in the wrong property being accessed - e.g. foo.Name could return foo.Bar. This could only happen when using the dynamic API during a migration and does not affect apps that use the strongly typed API or run on platforms other than .NET Core 3.x/.NET 5.
  • Fixed an issue that would cause deadlocks on Windows systems when 3 or more processes were listening for notifications on the same Realm file. (Core upgrade)
  • Fixed a bug that would prevent eventual consistency during conflict resolution. Affected clients would experience data divergence and potentially consistency errors as a result if they experienced conflict resolution between cycles of Create-Erase-Create for objects with the same primary key. (Core upgrade)
  • Fixed a bug that could lead to a crash when refreshing the user's custom data. (Core upgrade)
  • Fixed a bug that could cause an assertion n != realm::npos when integrating changesets from the server. (Core upgrade)

Enhancements

  • Added support of OpenID Connect credential for the Google authentication provider. (Issue #2108)
  • Optimized the internal code that handles conversions between types. This should result in a minor performance increase for most data operations that should be most noticeable on Ahead-of-Time compiled platforms, such as iOS/UWP. Due to the nature of the change, it's possible that conversions that previously happened automatically when working with dynamic objects no longer do. If you encounter a NotSupportedException with the message No conversion exists from *type A* to *type B* and believe this is a bug, please open a Github Issue. (PR #2149)

Compatibility

  • Realm Studio: 10.0.0 or later.
realm-dotnet - 10.0.0-beta.2 - Bug fixes

Published by nirinchev almost 4 years ago

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 and Realm.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.
realm-dotnet - 5.1.2 - UWP main thread fix

Published by nirinchev almost 4 years ago

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.
realm-dotnet - 10.0.0-beta.1 Decimal, ObjectId, Embedded Objects + MongoDB Realm support

Published by nirinchev about 4 years ago

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 to Realm.DynamicApi:
    • Realm.CreateObject(string className, object primaryKey) is now Realm.DynamicApi.CreateObject(string className, object primaryKey).
    • Realm.All(string className) is now Realm.DynamicApi.All(string className).
    • Realm.RemoveAll(string className) is now Realm.DynamicApi.RemoveAll(string className).
    • Realm.Find(string className, long? primaryKey) is now Realm.DynamicApi.Find(string className, long? primaryKey).
    • Realm.Find(string className, string primaryKey) is now Realm.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 the MapTo("_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 to SyncConfiguration.

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 types string, long, or ObjectId. 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-in decimal type. Note that .NET's built-in decimal is 96-bit, so it cannot represent the full range of numbers, representable by Decimal128. (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 of RealmObject. 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.
realm-dotnet - 5.1.1 - Bug Fixes

Published by nirinchev about 4 years ago

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.
realm-dotnet - 5.1.0 - Bug fixes and performance improvements

Published by nirinchev about 4 years ago

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.
realm-dotnet - 5.0.1 - Upgraded Core

Published by nirinchev about 4 years ago

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(), and IRealmCollection<T>.Freeze(). These methods will produce the frozen version of the instance on which they are called.
    • Added Realm.IsFrozen, RealmObject.IsFrozen, and IRealmCollection<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.
  • Add support for SynchronizationContext-confined Realms. Rather than being bound to a specific thread, queue-confined Realms are bound to a SynchronizationContext, regardless of whether it dispatches work on the same or a different thread. Opening a Realm when SynchronizationContext.Current is null - most notably Task.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.