Exemple #1
0
        public object CreateResource(string containerName, string fullTypeName)
        {
            HeaderAsEntity header = new HeaderAsEntity();

            _pendingInsert.Add(header);
            return(header);
        }
Exemple #2
0
 public void HttpHeadersChangeInterceptor(HeaderAsEntity header, UpdateOperations action)
 {
     if (action == UpdateOperations.Add && header.Value == null)
     {
         if (OperationContext.Current != null &&
             OperationContext.Current.IncomingMessageProperties != null &&
             ((HttpRequestMessageProperty)OperationContext.Current.IncomingMessageProperties["httpRequest"]).Headers != null)
         {
             var h = ((HttpRequestMessageProperty)OperationContext.Current.IncomingMessageProperties["httpRequest"]).Headers;
             header.Value = h["CustomTestHeader"];
         }
     }
 }
Exemple #3
0
        public void SetValue(object targetResource, string propertyName, object propertyValue)
        {
            HeaderAsEntity header = targetResource as HeaderAsEntity;

            if (header == null)
            {
                throw new InvalidOperationException("Only HeaderAsEntity types are supported in this update interface implementation");
            }

            switch (propertyName)
            {
            case "ID":
                header.ID = (string)propertyValue;
                break;

            case "Value":
                header.Value = (string)propertyValue;
                break;

            default:
                throw new InvalidOperationException("Only the 'ID' and 'Value' properties can be modified");
            }
        }