RavenDB Client is the client library for accessing RavenDB
$ dotnet add package RavenDB.ClientYou're looking at RavenDB .NET Client (SDK) NuGet release.
It makes it easy for you to communicate with your RavenDB instance, letting you perform any database operations with friendly API.
RavenDB is a NoSQL database that fuses extreme performance with ease-of-use, offering above the roof developer experience.
Learn more at https://ravendb.net or visit our GitHub repository.
Get the latest stable version from NuGet.
using (IDocumentStore store = new DocumentStore
{
Urls = new[] // URL to the Server,
{ // or list of URLs
"http://live-test.ravendb.net" // to all Cluster Servers (Nodes)
},
Database = "Northwind", // Default database that DocumentStore will interact with
Conventions = { } // DocumentStore customizations
})
{
store.Initialize(); // Each DocumentStore needs to be initialized before use.
// This process establishes the connection with the Server
// and downloads various configurations
// e.g. cluster topology or client configuration
}
using (IDocumentSession session = store.OpenSession()) // Open a session for a default 'Database'
{
Category category = new Category
{
Name = "Database Category"
};
session.Store(category); // Assign an 'Id' and collection (Categories)
// and start tracking an entity
Product product = new Product
{
Name = "RavenDB Database",
Category = category.Id,
UnitsInStock = 10
};
session.Store(product); // Assign an 'Id' and collection (Products)
// and start tracking an entity
session.SaveChanges(); // Send to the Server
// one request processed in one transaction
}
using (IDocumentSession session = store.OpenSession()) // Open a session for a default 'Database'
{
List<string> productNames = session
.Query<Product>() // Query for Products
.Where(x => x.UnitsInStock > 5) // Filter
.Skip(0).Take(10) // Page
.Select(x => x.Name) // Project
.ToList(); // Materialize query
}