using (var store = new DocumentStore { Urls = new[] { "http://localhost:8080" }, Database = "MyDatabase" }) { store.Initialize(); using (var session = store.OpenSession()) { // Perform CRUD operations here } }
using (var store = new DocumentStore { Urls = new[] { "http://localhost:8080" }, Database = "MyDatabase" }) { store.Initialize(); using (var session = store.OpenSession()) { var products = session.QueryThis example fetches all documents of type `Product` from the database using the LINQ syntax which is an extension of the C# language. It then iterates over the collection and prints the name of each product to the console. Both examples use the RavenDB package library, specifically the Raven.Client package, which provides the necessary classes and methods for interacting with the database.().ToList(); foreach (var product in products) { Console.WriteLine(product.Name); } } }