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); }
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(); }
public ArticleAppService(IArticleDomainService articleDomainService, IArticleTagDomainService articleTagDomainService, ITagDomainService tagDomainService) { _articleDomainService = articleDomainService; _articleTagDomainService = articleTagDomainService; _tagDomainService = tagDomainService; }
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; }
public ArticleAppService(IArticleDomainService articleDomainService, ICategoryDomainService categoryDomainService, ITagDomainService tagDomainService, IAgentDomainService agentDomainService) : base() { this._articleDomainService = articleDomainService; this._categoryDomainService = categoryDomainService; this._tagDomainService = tagDomainService; this._agentDomainService = agentDomainService; }
public ArticleAppService(IArticleDomainService articleDomainService, ITagDomainService tagDomainService, IArticleTagRelationDomainService articleTagRelationDomainService, ICategoryDomainService categoryDomainService) : base(articleDomainService) { this._articleDomainService = articleDomainService; this._tagDomainService = tagDomainService; this._articleTagRelationDomainService = articleTagRelationDomainService; this._categoryDomainService = categoryDomainService; }
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; }
public CategoryDomainService(IRepository <Category> repository, IArticleDomainService articleDomainService) : base(repository) { this._articleDomainService = articleDomainService; }
public ArticleApplicationService(IArticleDomainService domain) { _articleDomainService = domain; }