RavenDB
Sample MVC Project
- MVC Starter Kit is an example ASP.NET MVC project that uses RavenDB/
Nerd Dinner Raven Port
- a port of the nerd dinner in raven db mvc app.
Indexes
- Indexes are server-side functions that define using which fields (and what values) document can be searched on and are the only way to satisfy queries in RavenDB
- Indexes in RavenDB
Commands
- Commands are a set of low level operations that can be used to manipulate data and change configuration on a server.
- Commands
NorthWind Tutorials
Patterns
Why not to use the Repository Pattern
Sessions
- Session lifetime management is an infrastructure concern and should be handled at different level
- Initialise your session once at the beginning of HTTP request.
- Close your session at the end of HTTP request.
- Reuse the session across all operations
- How to config session in MVC - This is a good article, with the exception of the IOC stuff.
- Uses the UnitOfWork pattern
- Changes will only be persisted when SaveChanges() is called
- Writes are batched
- Sample from: RavenDB Docs
// Saving changes using the session API
using (IDocumentSession session = store.OpenSession())
{
// Operations against session
// Flush those changes
session.SaveChanges();
}
Mocking
- Don't use mocking with RavenDB. Use the code snipped below instead.
new EmbeddableDocumentStore{ RunInMemory =true }.Initialize();
Saftey
- If a page size value is not specified, the length of the results will be limited to 128 results
- Hard limit to the page size of 1,024 results on the server side