it:ad:ravendb:home

IT:AD:Data:Db:RavenDb

RavenDb is NOT free for commercial use.

Use nuget.org.

http://localhost:8080/raven/index.html
//open a db server (expensive, so minimize calls to open store):
using (var documentStore = new DocumentStore("localhost",8080).Initialize()
{
  //open a session on the db server
  using (var session = documentStore.OpenSession()){
    session.Store(new MyEntity {Val1="val1", Val2="val2"});
    session.Store(new MyEntity {Val1="val2", Val2="val3"});
    ..

    //commit:
    session.SaveChanges();
  }
}

Load a single record:

session.Load<MyEntity>(id);

Alternatly:

//open a db server (expensive, so minimize calls to open store):
using (var documentStore = new DocumentStore("localhost",8080).Initialize()
{
  //open a session on the db server
  using (var session = documentStore.OpenSession()){

    //Now make a query:
    var all = session
                .Query<MyEntity>
                . WaitForNonStaleResults()
                .ToArray();
                
    return all;
    
  }
  
}
  • /home/skysigal/public_html/data/pages/it/ad/ravendb/home.txt
  • Last modified: 2023/11/04 03:30
  • by 127.0.0.1