Browse Source
Merge pull request #12296 from abpframework/enisn/cms-kit-fixes
CmsKit - BlogFeature DataSeeding Fix
pull/11465/head
Engincan VESKE
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
7 additions and
0 deletions
-
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogFeatureDataSeedContributor.cs
-
modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/ICmsKitDbContext.cs
|
|
|
@ -1,6 +1,7 @@ |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Volo.Abp.Data; |
|
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
using Volo.Abp.GlobalFeatures; |
|
|
|
|
|
|
|
namespace Volo.CmsKit.Blogs; |
|
|
|
|
|
|
|
@ -19,6 +20,11 @@ public class BlogFeatureDataSeedContributor : IDataSeedContributor, ITransientDe |
|
|
|
|
|
|
|
public async Task SeedAsync(DataSeedContext context) |
|
|
|
{ |
|
|
|
if (!GlobalFeatureManager.Instance.IsEnabled<BlogFeature>()) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
var blogs = await _blogRepository.GetListAsync(); |
|
|
|
|
|
|
|
foreach (var blog in blogs) |
|
|
|
|
|
|
|
@ -26,6 +26,7 @@ public interface ICmsKitDbContext : IEfCoreDbContext |
|
|
|
DbSet<Page> Pages { get; } |
|
|
|
DbSet<Blog> Blogs { get; } |
|
|
|
DbSet<BlogPost> BlogPosts { get; } |
|
|
|
DbSet<BlogFeature> BlogFeatures { get; } |
|
|
|
DbSet<MediaDescriptor> MediaDescriptors { get; } |
|
|
|
DbSet<MenuItem> MenuItems { get; } |
|
|
|
DbSet<GlobalResource> GlobalResources { get; } |
|
|
|
|