示例#1
0
        /// <summary>
        /// Triggers one way replication from the source to target.  If bidirection is needed call this method twice with the source and target args reversed.
        /// </summary>
        /// <param name="source">Uri or database name of database to replicate from</param>
        /// <param name="target">Uri or database name of database to replicate to</param>
        /// <param name="continuous">Whether or not CouchDB should continue to replicate going forward on it's own</param>
        /// <returns></returns>
        public JObject TriggerReplication(string source, string target, bool continuous)
        {
            var request = GetRequest(baseUri + "_replicate");

            var options = new ReplicationOptions(source, target, continuous);
            var response = request.Post()
                .Data(options.ToString())
                .GetResponse();

            return response.GetJObject();
        }
示例#2
0
        //private static string GetBaseUri(string host, int port, bool isHttps)
        //{
        //    return isHttps ? "https://" + host + ":" + port + "/" : "http://" + host + ":" + port + "/";
        //}
        /// <summary>
        /// CouchClient constructor
        /// </summary>
        /// <param name="config"></param>
        //public CouchClient(CouchConfiguration config)
        //    : this(config.Host, config.Port, config.User, config.Password, false, AuthenticationType.Basic, DbType.CouchDb)
        //{
        //}
        /// <summary>
        /// Triggers one way replication from the source to target.  If bidirection is needed call this method twice with the source and target args reversed.
        /// </summary>
        /// <param name="source">Uri or database name of database to replicate from</param>
        /// <param name="target">Uri or database name of database to replicate to</param>
        /// <param name="continuous">Whether or not CouchDB should continue to replicate going forward on it's own</param>
        /// <returns></returns>
        public CouchResponseObject TriggerReplication(string source, string target, bool continuous)
        {
            var request = GetRequest(couchConnection.BaseUri.Combine("_replicate"));

            var options = new ReplicationOptions(source, target, continuous);
            var response = request.Post()
                .Data(options.ToString())
                .GetCouchResponse();

            return response.GetJObject();
        }