sdk/dotnet/src/Microsoft.Datasync.Client/Table/OfflineTable.cs
/// <summary>
/// Inserts an item into the offline table.
/// </summary>
/// <param name="instance">The instance to insert into the table.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> to observe.</param>
/// <returns>A task that returns the inserted data when complete.</returns>
Inserts an item into the offline table.
Inserts an item into the offline table .
public async Task<JObject> InsertItemAsync(JObject instance, CancellationToken cancellationToken = default)
        {
            string id = ServiceSerializer.GetId(instance, allowDefault: true);
            if (id == null)
            {
                id = IdGenerator?.Invoke(TableName) ?? Guid.NewGuid().ToString("N");
                instance = (JObject)instance.DeepClone();
                instance[SystemProperties.JsonIdProperty] = id;
            }
            await _context.InsertItemAsync(TableName, instance, cancellationToken);
            return instance;
        }
public async Task < JObject > InsertItemAsync ( JObject instance , CancellationToken cancellationToken = default ) { string id = ServiceSerializer . GetId ( instance , allowDefault : true ) ; if ( id == null ) { id = IdGenerator ? . Invoke ( TableName ) ?? Guid . NewGuid ( ) . ToString ( " " ) ; instance = ( JObject ) instance . DeepClone ( ) ; instance [ SystemProperties . JsonIdProperty ] = id ; } await _context . InsertItemAsync ( TableName , instance , cancellationToken ) ; return instance ; }
Inserts an item into the offline table.
Inserts an item into the offline table .
A task that returns the inserted data when complete.
A task that returns the inserted data when complete .
instance
JObject
The instance to insert into the table.
The instance to insert into the table .
cancellationToken
CancellationToken
A  to observe.
A to observe .