Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introducing RavenDB - Agile Persistence in .Net (Soft Shake 2013)

Introducing RavenDB - Agile Persistence in .Net (Soft Shake 2013)

Johnny Graber

October 24, 2013
Tweet

More Decks by Johnny Graber

Other Decks in Technology

Transcript

  1. Main Types of NoSQL •Key / Value Store •Graph Database

    •Column Database •Document Store
  2. Querying RavenDB var books = from books in session.Query<Book>() where

    books.Title.StartsWith("Raven") select books; var book = session.Load<Book>("books/1");
  3. Indexes in RavenDB •All Queries Need an Index •Static or

    Dynamic •Created in Background (Stale Index)
  4. Map/Reduce This is probably the most common error that people

    make with any sort of data access technology. "Just give me the whole thing, I'll make sense of it on the client side." In the RDBMS world, this would be expressed as "SELECT * FROM Orders". The problem with such queries is they can potentially… Map Reduce
  5. “When the Database must be correct the first time, every

    part of the application must be known at the beginning”
  6. Use RavenDB in Production •When You Know it •RavenDB Solves

    Your Problems •Have Time to Learn Even More
  7. More on CQRS & Polyglot Persistence •Martin Fowler: http://martinfowler.com/bliki/CQRS.html •Jimmy

    Bogard: Real World Polyglot Persistence http://vimeo.com/68320412
  8. Connect to RavenDB using (var documentStore = new DocumentStore {

    Url = "http://localhost:8080", DefaultDatabase = "Demo" }.Initialize()) using (var session = documentStore.OpenSession()) { // Your Code }
  9. The Book Class public class Book { public string Id

    { get; set; } public string Title { get; set; } public string ISBN { get; set; } public int Pages { get; set; } }
  10. Add Data to Session var book = new Book {

    Title = "RavenDB Intro", ISBN = "1", Pages = 200 }; session.Store(book); session.SaveChanges();
  11. Querying RavenDB var books = from books in session.Query<Book>() where

    books.Title.StartsWith("Raven") select books; var book = session.Load<Book>("books/1"); Back
  12. HTTP API: Create Document curl --header "Raven-Entity-Name: Books" -X PUT

    http://localhost:8080/databases/demo/docs/books/4 -d "{'Title':'HTML Collection', 'ISBN':'123-4','Pages':50}"