예제 #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)
            {
                string key   = keyvals[i];
                string value = keyvals[i + 1];

                if (string.IsNullOrEmpty(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);
        }
예제 #2
0
        public IRequest Data(KeyVal keyval)
        {
            if (keyval == null)
            {
                throw new ArgumentNullException("keyval");
            }

            _data.Add(keyval);

            return(this);
        }
예제 #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);
        }
예제 #4
0
        public IConnection Data(string key, string value)
        {
            req.Data(KeyVal.Create(key, value));

            return(this);
        }