public static bool TryGetBy <TKey>(this LightningTransaction txn, LightningDatabase db, TKey key, out GetByOperation value)
        {
            byte[] valueBytes;

            var keyBytes = db.ToBytes(key);
            var result   = txn.TryGet(db, keyBytes, out valueBytes);

            value = result
                ? new GetByOperation(db, valueBytes)
                : null;

            return(result);
        }
Exemple #2
0
 /// <summary>
 /// Tries obtaining a value by key
 /// </summary>
 /// <typeparam name="TKey">Type of a key.</typeparam>
 /// <param name="txn">A transaction.</param>
 /// <param name="key">Key.</param>
 /// <param name="value">Obtained value converter if successful.</param>
 /// <returns>Returns true if key-value pair exists in database or false if not.</returns>
 public static bool TryGetBy <TKey>(this LightningTransaction txn, TKey key, out GetByOperation value)
 {
     return(txn.TryGetBy(key, out value));
 }