title: MongoDb's C# Drivers, is it possible to wrap it in a generic session?
body: <p>I'm apologizing if I'm using the wrong terminology here. I'm still very much in the ORM world, but I've been playing around with MongoDb and really love what I see. One of the things I'm not liking is this:</p>
  
  <pre><code>var books = bookRepository.GetCollection&lt;BsonDocument&gt;("books");
  </code></pre>
  
  <p>And</p>
  
  <pre><code>foreach (var book in books.FindAllAs&lt;Book&gt;())
  {
      Console.WriteLine("Author: {0}, Title: {1}", book.Author, book.Title);
  }
  </code></pre>
  
  <p>I've found several tutorials on wrapping <a href="http://lukencode.com/2010/07/09/getting-started-with-mongodb-and-norm/" rel="noreferrer">NoRM in a session</a> but I can't figure out how to do it using the CSharp Drivers (the ones that Mongodb recommends / has on their github page).</p>
  
  <p>What I'd really like to do is something like this for the first example:</p>
  
  <pre><code>var bookRepository = MongoRepository&lt;Book&gt;(); // probably should use IoC to resolve this
  </code></pre>
  
  <p>and</p>
  
  <pre><code>foreach (var book in books.FindAll())
  </code></pre>
  
  <p>Voila! I'm probably not the first person to want this, using strings everywhere seems a bit nutty, though I will grant that the tutorial is just an example. Is there a "best practices" example to setting this all up in such a manner?</p>
  
  <p>Edit: Please let me know if this is crazy talk and not how to do things in Mongo, again this is my first test project.</p>