var store = new DocumentStore()
{
Url = @"http://localhost"
};
store.Initialize();
Blog blog = new Blog()
{
Title = "Hello RavenDB",
Category = "RavenDB",
Content = "This is a blog about RavenDB",
Comments = new BlogComment[]{
new BlogComment() { Title = "Unrealistic", Content= "This example is unrealistic"},
new BlogComment() { Title = "Nice", Content= "This example is nice"}
}
};
using (IDocumentSession session = store.OpenSession())
{
session.Store(blog);
session.SaveChanges();
}
上面的代码将数据保存到默认数据库。(它是一个 Web 应用程序。)但我希望它将数据保存到我创建的 raven 管理工作室(网页)的另一个数据库中。我在哪里指定数据库名称?另外请告诉我如何将连接字符串与数据库名称一起保存在配置文件中。这就是我将它保存到没有数据库名称的配置文件的方式
<connectionStrings>
<add name="Local" connectionString="DataDir = ~\Data"/>
<add name="Server" connectionString="Url = http://localhost:8080"/>
</connectionStrings>