コード例 #1
0
        private static MongoCollection <T> GetCollection <T>(MongoDatabase db, MongoCollectionSettings settings) where T : class
        {
            string collectionName = MongoCollectionName.Get <T>();

            // Default settings don't need special treatment as everything comes from connection string
            return(settings == null?db.GetCollection <T>(collectionName) : db.GetCollection <T>(collectionName, settings));
        }
コード例 #2
0
        private MongoCollection GetCollection(object container)
        {
            // Prefer the collection provided in ctor over the one given during id generation
            MongoDatabase db             = this.mongoDb ?? ((MongoCollection)container).Database;
            string        collectionName = MongoCollectionName.Get <Identity>();

            return(db.GetCollection(collectionName));
        }