Ejemplo n.º 1
0
        public BaseCollection(ICovidDatabaseSettings settings, string collectionName)
        {
            var client   = new MongoClient(settings.ConnectionString);
            var database = client.GetDatabase(settings.DatabaseName);

            Collection = (MongoCollectionBase <T>)database.GetCollection <T>(collectionName);
        }
Ejemplo n.º 2
0
        public static List <string> LoadUniquePageTypes()
        {
            MongoCollectionBase <PageView> Collection = Execute.GetCollection <PageView>(COLLECTION_NAME);

            //grab the last viewed page and set the exit time if exists
            IQueryable <string> PageTypes = Collection.AsQueryable <PageView>().Select(e => e.PageFriendlyURL).Distinct();

            return(PageTypes != null?PageTypes.ToList() : new List <string>());
        }
Ejemplo n.º 3
0
        internal static void CreateConnection(string dbName)
        {
            ConnectionString = @"mongodb://localhost:27017";

            var mongoClient = new MongoClient(ConnectionString);
            var db          = mongoClient.GetDatabase(dbName);

            Collection = (MongoCollectionBase <TestAggregate>)db.GetCollection <TestAggregate>(nameof(TestAggregate));
        }
Ejemplo n.º 4
0
        public BaseDataTests()
        {
            runner = MongoDbRunner.Start();
            MongoClient client = new MongoClient(runner.ConnectionString);

            MainClass.dbClient = client;
            settingsDB         = client.GetDatabase("Settings");
            var database = client.GetDatabase("IntegrationTest");

            collection = (MongoCollectionBase <BsonDocument>)database.GetCollection <BsonDocument>("TestCollection");
        }
Ejemplo n.º 5
0
        public void SetUp()
        {
            database = Substitute.For <IMongoDatabase>();

            questionCollection   = Substitute.For <MongoCollectionBase <Question> >();
            answerCollection     = Substitute.For <MongoCollectionBase <Answer> >();
            searchTermCollection = Substitute.For <MongoCollectionBase <SearchTerm> >();

            database.GetCollection <Question>(QuestionCollectionName).Returns(questionCollection);
            database.GetCollection <Answer>(AnswerCollectionName).Returns(answerCollection);
            database.GetCollection <SearchTerm>(SearchTermCollectionName).Returns(searchTermCollection);
        }
Ejemplo n.º 6
0
 public SearchTermRepository(IMongoContext context)
 {
     collection = context.GetSearchTermCollection();
 }
Ejemplo n.º 7
0
 public AnswerRepository(IMongoContext context)
 {
     collection = context.GetAnswerCollection();
 }