private EnsureEtagMatches ( string key, System.Guid etag ) : bool | ||
key | string | |
etag | System.Guid | |
Результат | bool |
private bool EnsureEtagMatches(string key, Guid? etag)
{
var readResult = Storage.Documents.Read(key);
if (readResult == null)
return false;
if(etag != null)
{
var existingEtag = new Guid(readResult.Key.Value<byte[]>("etag"));
if(existingEtag != etag.Value)
throw new ConcurrencyException("Could not delete " + key + " because it is already modified");
}
return true;
}