Helper for consistent Collection names in MongoDb

Here’s a little helper/wrapper system I created to ensure consistent naming across Collections when using the C# driver, I also ensure lazy loading and singleton for the collection through Lazy<T>() to help with memory/performance.

It basically takes the name of the Model object provided and pluralizes it as the collection name. I’m hoping that the Mongo team will add a variant to the driver so that excluding the collection name in the future will at least use a basic GetCollection<T>(typeof(T).Name) but in the mean time feel free to use this :slight_smile:

1 Like