Beispiel #1
0
        public async Task <MongoLoadResult> Process()
        {
            var repos = await ExtractRepositories();

            var steps = await ExtractFeatureSteps();

            var transformed = TransformMongoEntry(repos, steps);
            var tmp         = new MongoLoadResult()
            {
                NumberOfStepsLoaded = 3,
                NumberOfStepsToLoad = 3
            };

            return(await LoadMongoEntry(transformed));
        }
Beispiel #2
0
        public async Task <MongoLoadResult> LoadMongoEntry(List <MongoEntry> dataToLoad)
        {
            var result = new MongoLoadResult();

            result.NumberOfStepsToLoad = dataToLoad.Count;
            var client   = new MongoClient();
            var database = client.GetDatabase("KIHTB");
            await database.DropCollectionAsync(_collectionName);

            var collection = database.GetCollection <MongoEntry>(_collectionName);

            await collection.InsertManyAsync(dataToLoad);

            result.NumberOfStepsLoaded = (int)collection.Count(new BsonDocument());
            return(result);
        }