Added IHasEntityVersion to Cmskit (Page, Blogpost)

pull/15169/head
malik masis 2 years ago
parent 4df54918da
commit 5428f23a3a

@ -13,7 +13,7 @@ using Volo.CmsKit.EntityFrameworkCore;
namespace Volo.CmsKit.Migrations
{
[DbContext(typeof(UnifiedDbContext))]
[Migration("20221118063752_Initial")]
[Migration("20221216140823_Initial")]
partial class Initial
{
/// <inheritdoc />
@ -1488,6 +1488,9 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@ -1823,6 +1826,9 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");

@ -506,6 +506,7 @@ namespace Volo.CmsKit.Migrations
Script = table.Column<string>(type: "nvarchar(max)", nullable: true),
Style = table.Column<string>(type: "nvarchar(max)", nullable: true),
IsHomePage = table.Column<bool>(type: "bit", nullable: false),
EntityVersion = table.Column<int>(type: "int", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
@ -869,6 +870,7 @@ namespace Volo.CmsKit.Migrations
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
AuthorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Status = table.Column<int>(type: "int", nullable: false),
EntityVersion = table.Column<int>(type: "int", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),

@ -1485,6 +1485,9 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@ -1820,6 +1823,9 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");

@ -7,7 +7,7 @@ using Volo.CmsKit.Blogs;
namespace Volo.CmsKit.Admin.Blogs;
[Serializable]
public class BlogPostDto : EntityDto<Guid>, IHasCreationTime, IHasModificationTime, IHasConcurrencyStamp
public class BlogPostDto : EntityDto<Guid>, IHasCreationTime, IHasModificationTime, IHasConcurrencyStamp, IHasEntityVersion
{
public Guid BlogId { get; set; }
@ -26,6 +26,8 @@ public class BlogPostDto : EntityDto<Guid>, IHasCreationTime, IHasModificationTi
public DateTime? LastModificationTime { get; set; }
public string ConcurrencyStamp { get; set; }
public BlogPostStatus Status { get; set; }
public int EntityVersion { get; set; }
}

@ -1,11 +1,12 @@
using System;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities;
namespace Volo.CmsKit.Admin.Pages;
[Serializable]
public class PageDto : AuditedEntityDto<Guid>, IHasConcurrencyStamp
public class PageDto : AuditedEntityDto<Guid>, IHasConcurrencyStamp, IHasEntityVersion
{
public string Title { get; set; }
@ -18,6 +19,8 @@ public class PageDto : AuditedEntityDto<Guid>, IHasConcurrencyStamp
public string Style { get; set; }
public bool IsHomePage { get; set; }
public string ConcurrencyStamp { get; set; }
public int EntityVersion { get; set; }
}

@ -1,11 +1,11 @@
using System.Collections.Generic;
using System;
using System;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Auditing;
namespace Volo.CmsKit.Contents;
[Serializable]
public class PageDto : EntityDto<Guid>
public class PageDto : EntityDto<Guid>, IHasEntityVersion
{
public string Title { get; set; }
@ -16,4 +16,6 @@ public class PageDto : EntityDto<Guid>
public string Script { get; set; }
public string Style { get; set; }
public int EntityVersion { get; set; }
}

@ -1,13 +1,14 @@
using JetBrains.Annotations;
using System;
using System;
using JetBrains.Annotations;
using Volo.Abp;
using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
using Volo.CmsKit.Users;
namespace Volo.CmsKit.Blogs;
public class BlogPost : FullAuditedAggregateRoot<Guid>, IMultiTenant
public class BlogPost : FullAuditedAggregateRoot<Guid>, IMultiTenant, IHasEntityVersion
{
public virtual Guid BlogId { get; protected set; }
@ -29,9 +30,11 @@ public class BlogPost : FullAuditedAggregateRoot<Guid>, IMultiTenant
public Guid AuthorId { get; set; }
public virtual CmsUser Author { get; set; }
public virtual BlogPostStatus Status { get; set; }
public virtual int EntityVersion { get; protected set; }
protected BlogPost()
{
}
@ -81,12 +84,12 @@ public class BlogPost : FullAuditedAggregateRoot<Guid>, IMultiTenant
{
Content = Check.Length(content, nameof(content), BlogPostConsts.MaxContentLength);
}
public virtual void SetDraft()
{
Status = BlogPostStatus.Draft;
}
public virtual void SetPublished()
{
Status = BlogPostStatus.Published;

@ -1,12 +1,13 @@
using System;
using JetBrains.Annotations;
using Volo.Abp;
using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace Volo.CmsKit.Pages;
public class Page : FullAuditedAggregateRoot<Guid>, IMultiTenant
public class Page : FullAuditedAggregateRoot<Guid>, IMultiTenant, IHasEntityVersion
{
public virtual Guid? TenantId { get; protected set; }
@ -22,6 +23,8 @@ public class Page : FullAuditedAggregateRoot<Guid>, IMultiTenant
public virtual bool IsHomePage { get; protected set; }
public virtual int EntityVersion { get; protected set; }
protected Page()
{
}
@ -69,8 +72,8 @@ public class Page : FullAuditedAggregateRoot<Guid>, IMultiTenant
Style = Check.Length(style, nameof(style), PageConsts.MaxStyleLength);
}
internal void SetIsHomePage(bool isHomePage)
internal void SetIsHomePage(bool isHomePage)
{
IsHomePage = isHomePage;
}
}
}

Loading…
Cancel
Save