New in version 10.17.0.
Puede usar Ingesta de datos para transmitir datos desde la aplicación cliente a una aplicación Atlas App Services habilitada para Flexible Sync.
You might want to sync data unidirectionally in IoT applications, such as a weather sensor sending data to the cloud. Data Ingest is also useful for writing other types of immutable data where you do not require conflict resolution, such as creating invoices from a retail app or logging application events.
Data Ingest is optimized to provide performance improvements for heavy client-side insert-only workloads.
Importante
No se pueden query, modificar ni borrar objetos asimétricos desde una aplicación cliente. Como el objeto asimétrico no puede ser modificado por el cliente, el compilador no permitirá agregar una suscripción a un objeto asimétrico.
The .NET SDK allows you to work with Asymmetric objects and standard Realm objects within the same realm.
Sync Data Unidirectionally from a Client Application
Modificado en la versión 11.6.0.
Before you set up Data Ingest, you need to understand the following rules:
The C# objects that you will sync with Atlas must implement the IAsymmetricObject interface or derive from the AsymmetricObject class.
A partir de la versión 11.6.0 del SDK de .NET y posteriores, un objeto que implementa
IAsymmetricObjectPuede contener tipos IEmbeddedObject y enlaces aIRealmObjecttipos. En las versiones y anteriores del SDK de .NET,11.5.0 un objeto que implementaIAsymmetricObjectsolo puede contener tipos IEmbeddedObject; no admite enlaces aIRealmObjecttipos ni a otrosIAsymmetricObjecttipos.IRealmObjectandIEmbeddedObjecttypes cannot containIAsymmetricObjecttypes as properties.Unidirectional Sync requires Flexible Sync.
The process for syncing data asymmetrically is the same as standard bi-directional sync, as long as the rules above are followed. The following code shows creating an Asymmetric object and syncing it with the backend. It also shows to queries that generate errors.
private partial class Measurement : IAsymmetricObject { [] public Guid Id { get; private set; } = Guid.NewGuid(); public double Value { get; set; } public DateTimeOffset Timestamp { get; private set; } = DateTimeOffset.UtcNow; } public void SendMeasurementToRealm() { var measurement = new Measurement { Value = 9.876 }; realm.Write(() => { realm.Add(measurement); }); // The following line will cause a compile time error // _ = realm.All<Measurement>(); // The following line will compile but throw a // Realms.Exceptions.RealmInvalidObjectException at runtime // _ = measurement.Value; }
Atlas Device Sync gestiona completamente el ciclo de vida de estos datos. Se mantiene en el dispositivo hasta que la sincronización de Data Ingest se completa y luego se elimina del dispositivo.