コード例 #1
0
        //injected product repo
        //injected issue repo

        public void DoIt()
        {
            var observer = new Observer(); //get via identity
            var product  = new ProductRepository().Get(new ProductId(Guid.NewGuid()));

            var newIssue = product.CreateNewIssue(observer);

            newIssue.SetTitle("New issue");

            var issueRepo = new IssueRepository();

            issueRepo.Save(newIssue);
        }
コード例 #2
0
        private static void DownloadIssues()
        {
            try
            {
                Log.Logger.Information("Download issues started");

                var issueImporter   = ImporterFactory.GetIssueImporter();
                var issueRepository = new IssueRepository();

                var projectIds = _dbContext.Projects.Where(i => i.ExternalId.HasValue).Select(i => i.ExternalId.Value).ToArray();

                foreach (var issues in projectIds.Select(projectId => issueImporter.GetMany(projectId).ToArray()))
                {
                    issueRepository.Save(issues);
                }

                Log.Logger.Information("Download issues finished");
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex.Message);
            }
        }