Docs Menu
Docs Home
/ /
Atlas Device SDKs
/ /

Unidirectional Data Ingest - .NET SDK

On this page

  • Sync Data Unidirectionally from a Client Application

New in version 10.17.0.

You can use Data Ingest to stream data from the client application to a Flexible Sync-enabled Atlas App Services App.

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.

Important

You cannot query, modify, or delete Asymmetric objects from a client app. Because AsymmetricObject can not be modified by the client, the compiler will not let you add a subscription to an AsymmetricObject.

The .NET SDK allows you to work with Asymmetric objects and standard Realm objects within the same realm.

Changed in version 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.

  • Starting in .NET SDK version 11.6.0 and later, an object that implements IAsymmetricObject can contain IEmbeddedObject types, and links to IRealmObject types. In .NET SDK versions 11.5.0 and earlier, an object that implements IAsymmetricObject can only contain IEmbeddedObject types - it does not support links to IRealmObject types or other IAsymmetricObject types.

  • IRealmObject and IEmbeddedObject types cannot contain IAsymmetricObject types 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
{
[PrimaryKey, MapTo("_id")]
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 completely manages the lifecycle of this data. It is maintained on the device until Data Ingest synchronization is complete, and then removed from the device.

Back

Check Upload & Download Progress

Next

Partition-Based Sync