diff --git a/src/Fengling.Member.Domain/Aggregates/PointsModel/PointsAccount.cs b/src/Fengling.Member.Domain/Aggregates/PointsModel/PointsAccount.cs index c8cdb7b..61f4e94 100644 --- a/src/Fengling.Member.Domain/Aggregates/PointsModel/PointsAccount.cs +++ b/src/Fengling.Member.Domain/Aggregates/PointsModel/PointsAccount.cs @@ -4,12 +4,12 @@ using NetCorePal.Extensions.Primitives; namespace Fengling.Member.Domain.Aggregates.PointsModel; -public partial record PointsAccountId : IInt64StronglyTypedId +public partial record PointsAccountId : IGuidStronglyTypedId { - public static PointsAccountId New() => new PointsAccountId(0); - public long Value => this; - public static implicit operator long(PointsAccountId id) => id.Value; - public static implicit operator PointsAccountId(long value) => new PointsAccountId(value); + public static PointsAccountId New() => new PointsAccountId(Guid.NewGuid()); + public Guid Value => this; + public static implicit operator Guid(PointsAccountId id) => id.Value; + public static implicit operator PointsAccountId(Guid value) => new PointsAccountId(value); } public class PointsAccount : Entity, IAggregateRoot diff --git a/src/Fengling.Member.Infrastructure/EntityConfigurations/PointsAccountEntityTypeConfiguration.cs b/src/Fengling.Member.Infrastructure/EntityConfigurations/PointsAccountEntityTypeConfiguration.cs index 1023691..6750987 100644 --- a/src/Fengling.Member.Infrastructure/EntityConfigurations/PointsAccountEntityTypeConfiguration.cs +++ b/src/Fengling.Member.Infrastructure/EntityConfigurations/PointsAccountEntityTypeConfiguration.cs @@ -14,7 +14,7 @@ public class PointsAccountEntityTypeConfiguration : IEntityTypeConfiguration p.Id) .HasColumnName("id") - .UseSnowFlakeValueGenerator() + .UseGuidVersion7ValueGenerator() .HasComment("积分账户标识"); builder.Property(p => p.MemberId) diff --git a/src/Fengling.Member.Infrastructure/Repositories/PointsAccountRepository.cs b/src/Fengling.Member.Infrastructure/Repositories/PointsAccountRepository.cs index 0eec8b4..9d2cddc 100644 --- a/src/Fengling.Member.Infrastructure/Repositories/PointsAccountRepository.cs +++ b/src/Fengling.Member.Infrastructure/Repositories/PointsAccountRepository.cs @@ -2,7 +2,7 @@ using Fengling.Member.Domain.Aggregates.PointsModel; namespace Fengling.Member.Infrastructure.Repositories; -public interface IPointsAccountRepository : IRepository +public interface IPointsAccountRepository : IRepository { Task GetByMemberIdAsync(long memberId, CancellationToken cancellationToken = default); Task GetByMemberIdAndTenantIdAsync(long memberId, long tenantId, CancellationToken cancellationToken = default); @@ -12,7 +12,7 @@ public interface IPointsAccountRepository : IRepository } public class PointsAccountRepository(ApplicationDbContext context) : - RepositoryBase(context), IPointsAccountRepository + RepositoryBase(context), IPointsAccountRepository { public async Task GetByMemberIdAsync(long memberId, CancellationToken cancellationToken = default) {