Esempio n. 1
0
        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.");
                }
            }
        }
Esempio n. 2
0
 public void Get(string requestUri, IEntityWithETag e)
 {
     Get(requestUri, e != null ? new EntityTagHeaderValue($"\"{e?._ETag}\"") : null);
 }