コード例 #1
0
        internal IRequest BuildRequest()
        {
            IRequest request = service.CreateRequest(ResourcePath, MethodName);

            request.WithBody(GetSerializedBody());
            request.WithParameters(CreateParameterDictionary());
            request.WithETagAction(ETagAction);
            request.WithFields(FieldsMask);
            request.WithUserIp(UserIp);

            // Check if there is an ETag to attach.
            if (!string.IsNullOrEmpty(ETag))
            {
                request.WithETag(ETag);
            }
            else
            {
                // If no custom ETag has been set, try to use the one which might come with the body.
                // If this is a ISchemaResponse, the etag has been added to the object as it was created.
                IDirectResponseSchema body = GetBody() as IDirectResponseSchema;
                if (body != null)
                {
                    request.WithETag(body.ETag);
                }
            }

            return(request);
        }