|
|
|
|
@ -34,8 +34,9 @@ namespace Volo.CmsKit
|
|
|
|
|
private readonly IRatingRepository _ratingRepository;
|
|
|
|
|
private readonly ICurrentTenant _currentTenant;
|
|
|
|
|
private readonly IContentRepository _contentRepository;
|
|
|
|
|
private readonly IEntityTagManager _entityTagManager;
|
|
|
|
|
private readonly ITagManager _tagManager;
|
|
|
|
|
private readonly EntityTagManager _entityTagManager;
|
|
|
|
|
private readonly TagManager _tagManager;
|
|
|
|
|
private readonly ITagRepository _tagRepository;
|
|
|
|
|
private readonly IEntityTagRepository _entityTagRepository;
|
|
|
|
|
private readonly IPageRepository _pageRepository;
|
|
|
|
|
private readonly IBlogRepository _blogRepository;
|
|
|
|
|
@ -46,6 +47,7 @@ namespace Volo.CmsKit
|
|
|
|
|
private readonly IOptions<CmsKitTagOptions> _tagOptions;
|
|
|
|
|
private readonly IMediaDescriptorRepository _mediaDescriptorRepository;
|
|
|
|
|
private readonly IBlobContainer<MediaContainer> _mediaBlobContainer;
|
|
|
|
|
private readonly BlogManager _blogManager;
|
|
|
|
|
|
|
|
|
|
public CmsKitDataSeedContributor(
|
|
|
|
|
IGuidGenerator guidGenerator,
|
|
|
|
|
@ -56,18 +58,20 @@ namespace Volo.CmsKit
|
|
|
|
|
IRatingRepository ratingRepository,
|
|
|
|
|
ICurrentTenant currentTenant,
|
|
|
|
|
IContentRepository contentRepository,
|
|
|
|
|
ITagManager tagManager,
|
|
|
|
|
TagManager tagManager,
|
|
|
|
|
ITagRepository tagRepository,
|
|
|
|
|
IEntityTagRepository entityTagRepository,
|
|
|
|
|
IPageRepository pageRepository,
|
|
|
|
|
IBlogRepository blogRepository,
|
|
|
|
|
IBlogPostRepository blogPostRepository,
|
|
|
|
|
BlogPostManager blogPostmanager,
|
|
|
|
|
IBlogFeatureRepository blogFeatureRepository,
|
|
|
|
|
IEntityTagManager entityTagManager,
|
|
|
|
|
EntityTagManager entityTagManager,
|
|
|
|
|
IOptions<CmsKitOptions> options,
|
|
|
|
|
IOptions<CmsKitTagOptions> tagOptions,
|
|
|
|
|
IMediaDescriptorRepository mediaDescriptorRepository,
|
|
|
|
|
IBlobContainer<MediaContainer> mediaBlobContainer)
|
|
|
|
|
IBlobContainer<MediaContainer> mediaBlobContainer,
|
|
|
|
|
BlogManager blogManager)
|
|
|
|
|
{
|
|
|
|
|
_guidGenerator = guidGenerator;
|
|
|
|
|
_cmsUserRepository = cmsUserRepository;
|
|
|
|
|
@ -78,6 +82,7 @@ namespace Volo.CmsKit
|
|
|
|
|
_currentTenant = currentTenant;
|
|
|
|
|
_contentRepository = contentRepository;
|
|
|
|
|
_tagManager = tagManager;
|
|
|
|
|
_tagRepository = tagRepository;
|
|
|
|
|
_entityTagManager = entityTagManager;
|
|
|
|
|
_entityTagRepository = entityTagRepository;
|
|
|
|
|
_pageRepository = pageRepository;
|
|
|
|
|
@ -89,6 +94,7 @@ namespace Volo.CmsKit
|
|
|
|
|
_tagOptions = tagOptions;
|
|
|
|
|
_mediaDescriptorRepository = mediaDescriptorRepository;
|
|
|
|
|
_mediaBlobContainer = mediaBlobContainer;
|
|
|
|
|
_blogManager = blogManager;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task SeedAsync(DataSeedContext context)
|
|
|
|
|
@ -291,24 +297,40 @@ namespace Volo.CmsKit
|
|
|
|
|
|
|
|
|
|
private async Task SeedTagsAsync()
|
|
|
|
|
{
|
|
|
|
|
var created1 = await _tagManager.InsertAsync(_cmsKitTestData.TagId_1, _cmsKitTestData.EntityType1, _cmsKitTestData.TagName_1);
|
|
|
|
|
var created1 = await _tagRepository.InsertAsync(
|
|
|
|
|
await _tagManager.CreateAsync(
|
|
|
|
|
_cmsKitTestData.TagId_1,
|
|
|
|
|
_cmsKitTestData.EntityType1,
|
|
|
|
|
_cmsKitTestData.TagName_1));
|
|
|
|
|
|
|
|
|
|
await _entityTagManager.AddTagToEntityAsync(created1.Id, created1.EntityType, _cmsKitTestData.EntityId1);
|
|
|
|
|
|
|
|
|
|
var created2 = await _tagManager.InsertAsync(_cmsKitTestData.TagId_2, _cmsKitTestData.EntityType2, _cmsKitTestData.TagName_2);
|
|
|
|
|
var created2 = await _tagRepository.InsertAsync(
|
|
|
|
|
await _tagManager.CreateAsync(
|
|
|
|
|
_cmsKitTestData.TagId_2,
|
|
|
|
|
_cmsKitTestData.EntityType2,
|
|
|
|
|
_cmsKitTestData.TagName_2));
|
|
|
|
|
|
|
|
|
|
await _entityTagManager.AddTagToEntityAsync(created2.Id, created2.EntityType, _cmsKitTestData.EntityId2);
|
|
|
|
|
|
|
|
|
|
foreach (var tag in _cmsKitTestData.Content_1_Tags)
|
|
|
|
|
{
|
|
|
|
|
var tagEntity = await _tagManager.InsertAsync(_guidGenerator.Create(), _cmsKitTestData.Content_1_EntityType, tag);
|
|
|
|
|
var tagEntity = await _tagRepository.InsertAsync(
|
|
|
|
|
await _tagManager.CreateAsync(
|
|
|
|
|
_guidGenerator.Create(),
|
|
|
|
|
_cmsKitTestData.Content_1_EntityType,
|
|
|
|
|
tag));
|
|
|
|
|
|
|
|
|
|
await _entityTagManager.AddTagToEntityAsync(tagEntity.Id, _cmsKitTestData.Content_1_EntityType, _cmsKitTestData.Content_1_EntityId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var tag in _cmsKitTestData.Content_2_Tags)
|
|
|
|
|
{
|
|
|
|
|
var tagEntity = await _tagManager.InsertAsync(_guidGenerator.Create(), _cmsKitTestData.Content_2_EntityType, tag);
|
|
|
|
|
var tagEntity = await _tagRepository.InsertAsync(
|
|
|
|
|
await _tagManager.CreateAsync(
|
|
|
|
|
_guidGenerator.Create(),
|
|
|
|
|
_cmsKitTestData.Content_2_EntityType,
|
|
|
|
|
tag));
|
|
|
|
|
|
|
|
|
|
await _entityTagManager.AddTagToEntityAsync(tagEntity.Id, _cmsKitTestData.Content_2_EntityType, _cmsKitTestData.Content_2_EntityId);
|
|
|
|
|
}
|
|
|
|
|
@ -331,7 +353,10 @@ namespace Volo.CmsKit
|
|
|
|
|
|
|
|
|
|
private async Task SeedBlogsAsync()
|
|
|
|
|
{
|
|
|
|
|
var blog = await _blogRepository.InsertAsync(new Blog(_cmsKitTestData.Blog_Id, _cmsKitTestData.BlogName, _cmsKitTestData.BlogSlug), autoSave: true);
|
|
|
|
|
var blog = await _blogRepository.InsertAsync(
|
|
|
|
|
await _blogManager.CreateAsync(_cmsKitTestData.BlogName, _cmsKitTestData.BlogSlug));
|
|
|
|
|
|
|
|
|
|
_cmsKitTestData.Blog_Id = blog.Id;
|
|
|
|
|
|
|
|
|
|
var author = await _cmsUserRepository.GetAsync(_cmsKitTestData.User1Id);
|
|
|
|
|
|
|
|
|
|
|