sdk/dotnet/test/Microsoft.Datasync.Client.Test/Offline/SyncContext.Test.cs
/// <summary>
/// Creates some random records in a table
/// </summary>
/// <param name="tableName">The name of the table holding the records.</param>
/// <param name="itemCount">The number of items to create.</param>
/// <returns>The list of items created.</returns>
Creates some random records in a table
Creates some random records in a table
private List<JObject> AddRandomRecords(string tableName, int itemCount = 0)
        {
            if (itemCount <= 0)
            {
                itemCount = rnd.Next(1, 20);
            }
            List<JObject> records = new();
            for (var i = 0; i < itemCount; i++)
            {
                var item = (JObject)jsonObject.DeepClone();
                item["id"] = Guid.NewGuid().ToString();
                records.Add(item);
            }
            store.Upsert(tableName, records);
            return records;
        }
private List < JObject > AddRandomRecords ( string tableName , int itemCount = 0 ) { if ( itemCount <= 0 ) { itemCount = rnd . Next ( 1 , 20 ) ; } List < JObject > records = new ( ) ; for ( var i = 0 ; i < itemCount ; i ++ ) { var item = ( JObject ) jsonObject . DeepClone ( ) ; item [ " " ] = Guid . NewGuid ( ) . ToString ( ) ; records . Add ( item ) ; } store . Upsert ( tableName , records ) ; return records ; }
Creates some random records in a table
Creates some random records in a table
The list of items created.
The list of items created .
tableName
string
The name of the table holding the records.
The name of the table holding the records .
itemCount
int
The number of items to create.
The number of items to create .