Skip to content

Instantly share code, notes, and snippets.

@bradoyler
Created December 11, 2012 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradoyler/4261416 to your computer and use it in GitHub Desktop.
Save bradoyler/4261416 to your computer and use it in GitHub Desktop.
Querying multi-map index from MVC Controller using dynamics
private IDocumentSession _session;
public PeopleController(IDocumentSession session)
{
_session = session;
}
public ActionResult Index()
{ // insert a User & a Person into RavenDB
_session.Store(new User { Email = "user@domain.co", Name = "user 1", UserName = "user1" });
_session.Store(new Person { Email = "person@domain.co", Name = "person 1", PersonName = "person1" });
_session.SaveChanges();
//Query the index
ViewBag.people = _session.Query<dynamic, PeopleIndex>();
return View();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment