public async Task <ObjectPartitionWriteResult <T> > Save(T data, long id, UpdateAuditInfo audit, Metadata metadata = null) { await Initialise(); var enc = await _encryptor.Value; var obj = new ObjectWithMetadata <T>(data, metadata); var result = await _store.SaveObject(GetLocation(id), obj, audit, enc, _options); return(new ObjectPartitionWriteResult <T> { Id = id, Data = new ObjectWithMetadata <T>(data, result) }); }
public async Task Delete(string path, UpdateAuditInfo audit) { await Initialise(); await _store.Delete(GetLocation(path), audit, _options); }
public async Task <Metadata> Save(string path, Func <IWriteAsyncStream, Task> savingFunc, UpdateAuditInfo audit, CancellationToken token, Metadata metadata = null) { await Initialise(); var enc = await _encryptor.Value; return(await _store.SaveData(GetLocation(path), metadata, audit, savingFunc, token, enc, _options)); }
public async Task <ObjectPartitionWriteResult <T> > Save(T data, Expression <Func <T, long?> > idField, UpdateAuditInfo audit, Func <long, Task> preSaveProcessing = null, Metadata metadata = null) { await Initialise().ConfigureAwait(false); var member = idField.Body as MemberExpression; if (member == null) { throw new ArgumentException(string.Format("Expression '{0}' refers to a method, not a property.", idField.ToString())); } var propInfo = member.Member as PropertyInfo; if (propInfo == null) { throw new ArgumentException(string.Format("Expression '{0}' refers to a field, not a property.", idField.ToString())); } var id = (long?)propInfo.GetValue(data); if (!id.HasValue) { id = await _idGenerator.Value.NextId().ConfigureAwait(false); propInfo.SetValue(data, id); } if (preSaveProcessing != null) { await preSaveProcessing(id.Value).ConfigureAwait(false); } var enc = await _encryptor.Value.ConfigureAwait(false); var obj = new ObjectWithMetadata <T>(data, metadata); var result = await _store.SaveObject(GetLocation(id.Value), obj, audit, enc, _options).ConfigureAwait(false); return(new ObjectPartitionWriteResult <T> { Id = id.Value, Data = new ObjectWithMetadata <T>(data, result) }); }
public async Task Delete(long id, UpdateAuditInfo audit) { await Initialise().ConfigureAwait(false); await _store.Delete(GetLocation(id), audit, _options).ConfigureAwait(false); }
public async Task Delete(string path, UpdateAuditInfo audit) { await Initialise().ConfigureAwait(false); await _store.Delete(GetLocation(path), audit, _options).ConfigureAwait(false); }
public async Task<Metadata> Save(string path, Func<IWriteAsyncStream, Task> savingFunc, UpdateAuditInfo audit, CancellationToken token, Metadata metadata = null) { await Initialise().ConfigureAwait(false); var enc = await _encryptor.Value.ConfigureAwait(false); return await _store.SaveData(GetLocation(path), metadata, audit, savingFunc, token, enc, _options).ConfigureAwait(false); }