public static void VerifyETag(this IEntityWithETag newEntity, IEntityWithETag existingEntity) { if (existingEntity == null) { if (newEntity._ETag == "*") { throw new EntityTagMismatchException("Entity already exists."); } else { return; } } if (!string.IsNullOrEmpty(newEntity?._ETag)) { if (existingEntity?._ETag != newEntity._ETag) { throw new EntityTagMismatchException("Entity tags mismatch."); } } }
public void Get(string requestUri, IEntityWithETag e) { Get(requestUri, e != null ? new EntityTagHeaderValue($"\"{e?._ETag}\"") : null); }