コード例 #1
0
        private IMongoCollection <T> GetCollection <T>()
        {
            var client = new InMemoryClient();
            var db     = client.GetDatabase("test");
            var col    = db.GetCollection <T>(typeof(T).Name);

            return(col);
        }
コード例 #2
0
        private IMongoCollection <MyEntity> GetCollection(params MyEntity [] entities)
        {
            var client = new InMemoryClient();
            var db     = client.GetDatabase("test");
            var col    = db.GetCollection <MyEntity>("myEntities");

            col.InsertMany(entities);
            return(col);
        }