Raven db byexample

2,461 views

Published on

This is my presentation from NDC 2011 on Raven DB by example

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,461
On SlideShare
0
From Embeds
0
Number of Embeds
145
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Raven db byexample

  1. 1. Raven DB by Example<br />
  2. 2.
  3. 3.
  4. 4. SELECT DISTINCT ...<br />LEFT JOIN ...<br />LEFT JOIN ...<br />LEFT JOIN ...<br />WHERE ...<br />AND…<br />OR…<br />
  5. 5. What’s in this talk?<br />WorkingsofRaven DB<br />WorkingwithRaven DB<br />Someexamples<br />
  6. 6. Whythis talk?<br />Documentdatabases is not onlyabout web scalability.<br />
  7. 7. Whoam I?<br />Emil Cardell<br />Web developer<br />Valtech Sweden<br />@emilcardell<br />www.unwillingcoder.com<br />
  8. 8. Howdoes it work?<br />
  9. 9. Howdoes it work?<br />
  10. 10. Howdoes it work?<br />Value<br />
  11. 11. Howdoes it work?<br />Metadata<br />Content<br />
  12. 12. Howdoes it work?<br />Metadata<br />Content<br />Blobstorage<br />
  13. 13. Whatdoesthis gives us?<br />Fast reads<br />Fast writes<br />Full consistency<br />
  14. 14. Whataboutqueries?<br />
  15. 15. Whataboutqueries?<br />Document store<br />
  16. 16. Whataboutqueries?<br />Lucene Index<br />Document store<br />
  17. 17. Whataboutqueries?<br />Lucene Index<br />Document store<br />Background workers<br />
  18. 18. Whataboutqueries?<br />Lucene Index<br />Document store<br />Background workers<br />
  19. 19. Whataboutqueries?<br />Lucene Index<br />Document store<br />Background workers<br />
  20. 20. Whataboutqueries?<br />Lucene Index<br />Document store<br />Background workers<br />
  21. 21. Whatdoesthis gives us?<br />Fast queries<br />Full free text search<br />Eventualconsistency<br />
  22. 22. How do youworkwith it?<br />HTTP/REST<br />JSON<br />Lucene Queries<br />Linq<br />
  23. 23. Whatsuniqe?<br />Dynamicqueries<br />Transactions (DTC)<br />Batching<br />Live projections<br />
  24. 24. How do youmodel?<br />
  25. 25. The opposite!<br />No referentialintegritry<br />Denomalize<br />Duplicate<br />Isolate by change<br />
  26. 26. Show me the code!<br />Event publishing<br />
  27. 27. Content Management<br />public interfaceIContent<br />{<br />stringId { get; set; }<br />stringParentId { get; set; }<br />string[] AncestorsId { get; set; }<br />stringSlug { get; set; }<br />stringUrl { get; set; }<br />}<br />
  28. 28. Content Management<br />varstore = newDocumentStore<br />{<br />Url= "http://localhost:8080",<br />Conventions = <br />{<br />FindTypeTagName =type=> typeof(IContent).IsAssignableFrom(type) ?typeof(IContent).Name : null<br /> } <br />};<br />
  29. 29. Content Management<br />public classHierarchyTrigger: AbstractPutTrigger<br />{<br /> public overrideVetoResultAllowPut(...)<br /> {<br />//Check for hierachical loops<br /> }<br /> public overridevoidOnPut(...)<br /> {<br />//Calculateancestors<br /> //Calculateurl<br /> }<br />}<br />
  30. 30. Content Management<br />varresults=documentSession.Query<IContent>()<br />.Where(x =>x.Ancestors.Any(pageid=><br />pageid== ”pages/myUniqeId"));<br />
  31. 31. If I wantcomments?<br />varcontent= Session.Load<IContent>(_pageId);<br />varcomments = Session.Load<PostComments>(_pageId);<br />varcomment= newComment<br />{<br />Id = Guid.NewGuid(),<br />Author= _commentInput.Name,<br /> //...<br />};<br />content.CommentsCount++;<br />comments.Comments.Add(comment);<br />
  32. 32. Document databases is not only about web scalability.<br />
  33. 33. Emil Cardell<br />emil.cardell@valtech.se<br />@emilcardell<br />RavenDB:<br />www.ravendb.net<br />Images:<br />Photo © 2011 Britta Heise<br />

×