public TaxonomyTree(ILog log, TaxonRepository repo, RelationService relationSrv, int rootId)
        {
            this.log         = log;
            this.rootId      = rootId;
            this.repo        = repo;
            this.relationSrv = relationSrv;
            rootEntity       = repo.Get(rootId);

            if (rootEntity == null)
            {
                if (rootId == 1)
                {
                    rootEntity = new TaxonEntity()
                    {
                        Name        = "Root",
                        Description = "Root node - parent of all taxon entries"
                    };
                    repo.Save(rootEntity);
                }
                else
                {
                    throw new Exception("Root node is not found");
                }
            }
            rootNode = new TaxonomyNode(this, rootEntity);
        }
示例#2
0
        public MetricsService(
            MetricsRepository metricsRepo,
            MetricsEntryRepository metricsEntryRepo,
            RelationService relationService,
            TaxonomyTree taxonomyTree,
            ILog log)
        {
            this.metricsRepo      = metricsRepo;
            this.metricsEntryRepo = metricsEntryRepo;
            this.relationService  = relationService;
            this.log = log;

            relationNode = taxonomyTree.GetOrCreatePath(RELATIONS_PATH, "MetricsRepository relations");
        }
 public TaxonomyTree(ILog log, TaxonRepository repo, RelationService relationSrv) : this(log, repo, relationSrv, 1)
 {
 }