I want to do a simple thing: get the database names on a RavenDB server. Looks straightforward according to the docs (https://ravendb.net/docs/article-page/4.1/csharp/client-api/operations/server-wide/get-database-names), however I'm facing a chicken-and-egg problem.
The problem comes because I want to get the database names without knowing them in advance. The code in the docs works great, but requires to have an active connection to a DocumentStore. And to get an active connection to a DocumentStore, is mandatory to select a valid database. Otherwise I can't execute the GetDatabaseNamesOperation.
That makes me think that I'm missing something. Is there any way to get the database names without having to know at least one of them?
小智 5
数据库不是开设商店所必需的。以下代码可以正常工作:
using (var store = new DocumentStore
{
Urls = new[] { "http://live-test.ravendb.net" }
})
{
store.Initialize();
var dbs = store.Maintenance.Server.Send(new GetDatabaseNamesOperation(0, 25));
}
Run Code Online (Sandbox Code Playgroud)
我们将 GetDatabaseNamesOperation 发送到 ServerStore,它对所有数据库都是通用的,并保存通用数据(如数据库名称)。
| 归档时间: |
|
| 查看次数: |
68 次 |
| 最近记录: |