Exemple #1
0
        public Task <IEnumerable <Value> > FindAllAsync(string tableName, Key key)
        {
            EnsureArg.IsNotNullOrEmpty(tableName, nameof(tableName));
            EnsureArg.IsNotNull(key, nameof(key));

            using (var tx = this.env.BeginTransaction())
                using (var db = tx.OpenDatabase(tableName, new DatabaseConfiguration {
                    Flags = DatabaseOpenFlags.Create
                }))
                {
                    var value  = tx.Get(db, Encoding.UTF8.GetBytes($"{key.PartitionKey}-{key.RowKey}"));
                    var result = SerializationHelper.BsonByteDeserialize <Value>(value);
                    result.PartitionKey = key.PartitionKey;
                    result.RowKey       = key.RowKey;

                    return(Task.FromResult(new[] { result }.AsEnumerable()));
                }
        }