예제 #1
0
        public void InsertProject(Project project, List<Commits> commits)
        {
            var database = GetDatabase();
            var projects = database.GetCollection<Project>("projects");

            projects.Insert(project);

            var colCommits = database.GetCollection<Commits>("commits");
            colCommits.InsertBatch(commits);
        }
예제 #2
0
        private void InsertCommits(string repositoryUrl, IQueryable<Commit> commits)
        {
            var project = new Project()
                {
                    RepositoryUrl = repositoryUrl,
                    RepositoryAuthor = GetRepositoryAuthor(repositoryUrl),
                    RepositoryName = GetRepositoryName(repositoryUrl)
                };

            var colCommits = commits.Select(x => new Commits { Author = x.Author.Name, Date = x.Author.When.UtcDateTime, SHA = x.Sha, RepositoryUrl = repositoryUrl}).ToList();

            new MongoRepository().InsertProject(project, colCommits);
        }