From 7c4b76de30947354701f5687b353fe4096784b87 Mon Sep 17 00:00:00 2001 From: enisn Date: Mon, 25 Jan 2021 14:00:39 +0300 Subject: [PATCH] CmsKit - Model creating fix --- .../CmsKitDbContextModelCreatingExtensions.cs | 66 +++++++------------ 1 file changed, 23 insertions(+), 43 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs index 2cc5e8a52a..60cf1332f8 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs @@ -62,6 +62,10 @@ namespace Volo.CmsKit.EntityFrameworkCore b.HasIndex(x => new {x.TenantId, x.CreatorId, x.EntityType, x.EntityId, x.ReactionName}); }); } + else + { + builder.Ignore(); + } if (GlobalFeatureManager.Instance.IsEnabled()) { @@ -80,6 +84,10 @@ namespace Volo.CmsKit.EntityFrameworkCore b.HasIndex(x => new {x.TenantId, x.RepliedCommentId}); }); } + else + { + builder.Ignore(); + } if (GlobalFeatureManager.Instance.IsEnabled()) { @@ -96,6 +104,10 @@ namespace Volo.CmsKit.EntityFrameworkCore r.HasIndex(x => new { x.TenantId, x.EntityType, x.EntityId, x.CreatorId }); }); } + else + { + builder.Ignore(); + } if (GlobalFeatureManager.Instance.IsEnabled()) { @@ -112,6 +124,10 @@ namespace Volo.CmsKit.EntityFrameworkCore b.HasIndex(x => new { x.TenantId, x.EntityType, x.EntityId }); }); } + else + { + builder.Ignore(); + } if (GlobalFeatureManager.Instance.IsEnabled()) { @@ -145,50 +161,10 @@ namespace Volo.CmsKit.EntityFrameworkCore b.HasIndex(x => new { x.TenantId, x.EntityId, x.TagId }); }); } - - if (GlobalFeatureManager.Instance.IsEnabled()) + else { - builder.Entity(b => - { - b.ToTable(options.TablePrefix + "Pages", options.Schema); - - b.ConfigureByConvention(); - - b.Property(x => x.Title).IsRequired().HasMaxLength(PageConsts.MaxTitleLength); - b.Property(x => x.Url).IsRequired().HasMaxLength(PageConsts.MaxUrlLength); - b.Property(x => x.Description).HasMaxLength(PageConsts.MaxDescriptionLength); - - b.HasIndex(x => new { x.TenantId, x.Url }); - }); - } - - if (GlobalFeatureManager.Instance.IsEnabled()) - { - builder.Entity(b => - { - b.ToTable(options.TablePrefix + "Tags", options.Schema); - - b.ConfigureByConvention(); - - b.Property(x => x.EntityType).IsRequired().HasMaxLength(TagConsts.MaxEntityTypeLength); - b.Property(x => x.Name).IsRequired().HasMaxLength(TagConsts.MaxNameLength); - - b.HasIndex(x => new {x.TenantId, x.Name}); - }); - - builder.Entity(b => - { - b.ToTable(options.TablePrefix + "EntityTags", options.Schema); - - b.ConfigureByConvention(); - - b.HasKey(x => new {x.EntityId, x.TagId}); - - b.Property(x => x.EntityId).IsRequired(); - b.Property(x => x.TagId).IsRequired(); - - b.HasIndex(x => new {x.TenantId, x.EntityId, x.TagId}); - }); + builder.Ignore(); + builder.Ignore(); } if (GlobalFeatureManager.Instance.IsEnabled()) @@ -206,6 +182,10 @@ namespace Volo.CmsKit.EntityFrameworkCore b.HasIndex(x => new {x.TenantId, x.Url}); }); } + else + { + builder.Ignore(); + } } } } \ No newline at end of file