示例#1
0
        internal CouchDbRepositoryBase(string host, int port, string database = null, string username = null, string password = null)
        {
            if (String.IsNullOrEmpty(database))
            {
                database = typeof(T).Name;
            }
            _database = database.ToLower(); // CouchDb requires lowercase  database names

            _serverUrl = String.Format("http://{0}:{1}", host, port);

            Client = new CouchDbClient <T>(_serverUrl, _database);

            if (!CouchDbManager.HasDatabase(_serverUrl, _database))
            {
                CouchDbManager.CreateDatabase(_serverUrl, _database);
            }
        }