TorchAutoModerator/Utils.General/StupidDb.cs
/// <summary>
/// Insert documents to specified table.
/// </summary>
/// <remarks>
/// Existing documents will be overwritten by new documents with an identical ID string.
/// </remarks>
/// <param name="tableName">Name of the table to insert.</param>
/// <param name="documents">Collection of documents to insert.</param>
/// <typeparam name="T">Type of documents to insert.</typeparam>
Insert documents to specified table.
Insert documents to specified table .
[MethodImpl(MethodImplOptions.Synchronized)]
        public void Insert<T>(string tableName, IEnumerable<T> documents)
        {
            var table = GetTableObject<T>(tableName);
            foreach (var document in documents)
            {
                var id = GetId(document);
                table[id] = document;
            }
            var newTableToken = JToken.FromObject(table);
            _ramCopy[tableName] = newTableToken;
        }
[ MethodImpl ( MethodImplOptions . Synchronized ) ] public void Insert < T > ( string tableName , IEnumerable < T > documents ) { var table = GetTableObject < T > ( tableName ) ; foreach ( var document in documents ) { var id = GetId ( document ) ; table [ id ] = document ; } var newTableToken = JToken . FromObject ( table ) ; _ramCopy [ tableName ] = newTableToken ; }
Insert documents to specified table.
Insert documents to specified table .
tableName
string
Name of the table to insert.
Name of the table to insert .
documents
IEnumerable<T>
Collection of documents to insert.
Collection of documents to insert .
remarks
Existing documents will be overwritten by new documents with an identical ID string.
Existing documents will be overwritten by new documents with an identical ID string .
typeparam
Type of documents to insert.
Type of documents to insert .