diff --git a/src/Fengling.Member.Domain/Aggregates/PointsModel/PointsAccount.cs b/src/Fengling.Member.Domain/Aggregates/PointsModel/PointsAccount.cs index f7fa2af..35a9b07 100644 --- a/src/Fengling.Member.Domain/Aggregates/PointsModel/PointsAccount.cs +++ b/src/Fengling.Member.Domain/Aggregates/PointsModel/PointsAccount.cs @@ -1,8 +1,18 @@ using Fengling.Member.Domain.Events.Points; +using NetCorePal.Extensions.Domain; +using NetCorePal.Extensions.Primitives; namespace Fengling.Member.Domain.Aggregates.PointsModel; -public class PointsAccount : Entity, IAggregateRoot +public partial record PointsAccountId : IInt64StronglyTypedId +{ + public static PointsAccountId New() => new PointsAccountId(IdGenerator.Instance.GetLong()); + public long Value => this; + public static implicit operator long(PointsAccountId id) => id.Value; + public static implicit operator PointsAccountId(long value) => new PointsAccountId(value); +} + +public class PointsAccount : Entity, IAggregateRoot { public long MemberId { get; private set; } public long TenantId { get; private set; } @@ -12,6 +22,8 @@ public class PointsAccount : Entity, IAggregateRoot public int Version { get; private set; } = 1; public DateTime CreatedAt { get; private set; } = DateTime.UtcNow; public DateTime? UpdatedAt { get; private set; } + public Deleted Deleted { get; private set; } = new(); + public RowVersion RowVersion { get; private set; } = new(0); private readonly List _transactions = new(); public IReadOnlyCollection Transactions => _transactions.AsReadOnly(); diff --git a/src/Fengling.Member.Domain/Aggregates/Users/Member.cs b/src/Fengling.Member.Domain/Aggregates/Users/Member.cs index 1a790d6..4213ace 100644 --- a/src/Fengling.Member.Domain/Aggregates/Users/Member.cs +++ b/src/Fengling.Member.Domain/Aggregates/Users/Member.cs @@ -1,5 +1,6 @@ using System.Text.RegularExpressions; using Fengling.Member.Domain.Events.Member; +using NetCorePal.Extensions.Domain; namespace Fengling.Member.Domain.Aggregates.Users; @@ -23,6 +24,8 @@ public class MemberEntity : Entity, IAggregateRoot public DateTime CreatedAt { get; private set; } = DateTime.UtcNow; public DateTime? UpdatedAt { get; private set; } public int Version { get; private set; } = 1; + public Deleted Deleted { get; private set; } = new(); + public RowVersion RowVersion { get; private set; } = new(0); private readonly List _tags = new(); public IReadOnlyCollection Tags => _tags.AsReadOnly(); diff --git a/src/Fengling.Member.Infrastructure/EntityConfigurations/PointsAccountEntityTypeConfiguration.cs b/src/Fengling.Member.Infrastructure/EntityConfigurations/PointsAccountEntityTypeConfiguration.cs index 52a39c7..1023691 100644 --- a/src/Fengling.Member.Infrastructure/EntityConfigurations/PointsAccountEntityTypeConfiguration.cs +++ b/src/Fengling.Member.Infrastructure/EntityConfigurations/PointsAccountEntityTypeConfiguration.cs @@ -14,7 +14,8 @@ public class PointsAccountEntityTypeConfiguration : IEntityTypeConfiguration p.Id) .HasColumnName("id") - .UseIdentityColumn(); + .UseSnowFlakeValueGenerator() + .HasComment("积分账户标识"); builder.Property(p => p.MemberId) .HasColumnName("user_id")