title: MongoDB C# Driver database.GetCollection and magic strings
body: <p>Just getting into the NoSQL stuff so forgive me if this is a simple question. I am trying to somewhat implement a repository type pattern using a generic repository for the more common operations.</p>
  
  <p>One thing that I have run into that is killing this idea is that in order to get the collection you plan to work with you have to pass a string value for the name of the collection.</p>
  
  <pre><code>var collection = database.GetCollection&lt;Entity&gt;("entities");
  </code></pre>
  
  <p>This means that I have to hard code my collection names or code up a dictionary somewhere to act as a lookup so that i can map the object type to a collection name.</p>
  
  <p>How is everyone else handling this?</p>