Exemplo n.º 1
0
        public IConnection Data(params string[] keyvals)
        {
            if (keyvals == null)
            {
                throw new ArgumentNullException("keyvals");
            }

            if ((keyvals.Length % 2) != 0)
            {
                throw new InvalidOperationException("Must supply an even number of key value pairs");
            }

            for (int i = 0; i < keyvals.Length; i += 2)
            {
                var key   = keyvals[i];
                var value = keyvals[i + 1];

                if (string.IsNullOrWhiteSpace(key))
                {
                    throw new ArgumentException("Data key must not be empty");
                }

                if (value == null)
                {
                    throw new ArgumentException("Data value must not be null");
                }

                req.Data(KeyVal.Create(key, value));
            }

            return(this);
        }
Exemplo n.º 2
0
        public IRequest Data(KeyVal keyval)
        {
            if (keyval == null)
            {
                throw new ArgumentNullException("keyval");
            }

            data.Add(keyval);

            return(this);
        }
Exemplo n.º 3
0
        public IConnection Data(IDictionary <string, string> data)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            foreach (KeyValuePair <string, string> entry in data)
            {
                req.Data(KeyVal.Create(entry.Key, entry.Value));
            }

            return(this);
        }
Exemplo n.º 4
0
 public IConnection Data(string key, string fileName, Stream stream)
 {
     req.Data(KeyVal.Create(key, fileName, stream));
     return(this);
 }
Exemplo n.º 5
0
 public IConnection Data(string key, string value)
 {
     req.Data(KeyVal.Create(key, value));
     return(this);
 }