示例#1
0
        public void DeleteAndAdoptChildren(Guid id, Guid targetId)
        {
            Category category = _repository.Get(id);

            var childrenCategory = _repository.List(new CategoryFilterSpecification(id));

            foreach (var child in childrenCategory)
            {
                child.ParentId = targetId;
                _repository.Update(child);
            }

            // maybe have performance issue for cascading delete
            IArticleDomainService articleDomainService = _container.Resolve <IArticleDomainService>();

            var articles = articleDomainService.List(new ArticleFilterSpecification(id));

            foreach (var article in articles)
            {
                articleDomainService.Update(new ArticleUpdateBo()
                {
                    CategoryId = article.CategoryId
                });
            }

            _repository.Delete(category);
        }
示例#2
0
        public ArticleAppService(IArticleDomainService articleDomainService,
                                 ICategoryDomainService categoryDomainService) : base()
        {
            this._articleDomainService  = articleDomainService;
            this._categoryDomainService = categoryDomainService;

            MapperConfiguration configuration = new MapperConfiguration(config => {
                // because tags should be included, and if not include we should not return a empty array []
                config.AllowNullCollections = true;

                config.AddProfile(new AgentMapperProfile());
                config.AddProfile(new CategoryMapperProfile());

                config.CreateMap <Article, ArticleDto>();
                config.CreateMap <Article, ArticleWithIncludeDto>();
                config.CreateMap <ArticleTag, Guid>().ConvertUsing(t => t.TagId);

                config.CreateMap <ArticleCreateDto, Article>();
                config.CreateMap <ArticleUpdateDto, ArticleUpdateBo>();

                config.CreateMap <ArticleTagsDto, Article>();
                config.CreateMap <Article, ArticleTagsDto>();
            });

            this.Mapper = configuration.CreateMapper();
        }
示例#3
0
 public ArticleAppService(IArticleDomainService articleDomainService,
                          IArticleTagDomainService articleTagDomainService,
                          ITagDomainService tagDomainService)
 {
     _articleDomainService    = articleDomainService;
     _articleTagDomainService = articleTagDomainService;
     _tagDomainService        = tagDomainService;
 }
示例#4
0
 public RentalApplicationService(IRentalDomainService rentalDomainService,
                                 IArticleDomainService articleDomainService,
                                 IClientDomainService clientDomainService)
 {
     _rentalDomainService  = rentalDomainService;
     _articleDomainService = articleDomainService;
     _clientDomainService  = clientDomainService;
 }
 public BlogSpaceDomainService(IBlogSpaceRepository blogSpaceRepository, IMemberRepository memberRepository, IArticleRepository articleRepository, IMemberDomainService memberDomainService, IArticleDomainService articleDomainService)
 {
     _blogRepository       = blogSpaceRepository;
     _memberRepository     = memberRepository;
     _articleRepository    = articleRepository;
     _memberDomainService  = memberDomainService;
     _articleDomainService = articleDomainService;
 }
示例#6
0
 public ArticleAppService(IArticleDomainService articleDomainService,
                          ICategoryDomainService categoryDomainService,
                          ITagDomainService tagDomainService,
                          IAgentDomainService agentDomainService) : base()
 {
     this._articleDomainService  = articleDomainService;
     this._categoryDomainService = categoryDomainService;
     this._tagDomainService      = tagDomainService;
     this._agentDomainService    = agentDomainService;
 }
示例#7
0
 public ArticleAppService(IArticleDomainService articleDomainService,
                          ITagDomainService tagDomainService,
                          IArticleTagRelationDomainService articleTagRelationDomainService,
                          ICategoryDomainService categoryDomainService) : base(articleDomainService)
 {
     this._articleDomainService            = articleDomainService;
     this._tagDomainService                = tagDomainService;
     this._articleTagRelationDomainService = articleTagRelationDomainService;
     this._categoryDomainService           = categoryDomainService;
 }
示例#8
0
        public void Delete(Guid id)
        {
            Category category = _repository.Get(id);

            var children = _repository.List(new CategoryFilterSpecification(id));

            foreach (var child in children)
            {
                Delete(child.Id);
            }

            IArticleDomainService articleDomainService = _container.Resolve <IArticleDomainService>();

            var articles = articleDomainService.List(new ArticleFilterSpecification(id, null, null));

            foreach (var article in articles)
            {
                articleDomainService.Delete(article.Id);
            }
            _repository.Delete(category);
        }
 public ArticleApplicationService(IArticleDomainService articleDomainService)
 {
     _articleDomainService = articleDomainService;
 }
示例#10
0
 public CategoryDomainService(IRepository <Category> repository, IArticleDomainService articleDomainService) : base(repository)
 {
     this._articleDomainService = articleDomainService;
 }
 public ArticleApplicationService(IArticleDomainService domain)
 {
     _articleDomainService = domain;
 }