refactor: apply CleanDDD strongly typed ID and add Deleted/RowVersion
- Convert CampaignId to partial record implementing IGuidStronglyTypedId - Add PointsAccountId as IInt64StronglyTypedId with Snowflake ID generation - Add Deleted and RowVersion to MemberEntity and PointsAccount - Update PointsAccountEntityTypeConfiguration to use SnowFlakeValueGenerator BREAKING CHANGE: PointsAccount now uses PointsAccountId (long) instead of plain long
This commit is contained in:
parent
ab8d12527e
commit
70fac0f60e
@ -1,18 +1,9 @@
|
|||||||
namespace Fengling.Activity.Domain.ValueObjects;
|
namespace Fengling.Activity.Domain.ValueObjects;
|
||||||
|
|
||||||
public class CampaignId : IEquatable<CampaignId>
|
public partial record CampaignId : IGuidStronglyTypedId
|
||||||
{
|
{
|
||||||
public Guid Value { get; }
|
public static CampaignId New() => new CampaignId(Guid.NewGuid());
|
||||||
|
public Guid Value => this;
|
||||||
private CampaignId(Guid value) => Value = value;
|
|
||||||
|
|
||||||
public static CampaignId New() => new(Guid.NewGuid());
|
|
||||||
public static CampaignId FromGuid(Guid value) => new(value);
|
|
||||||
public static CampaignId Parse(string value) => new(Guid.Parse(value));
|
|
||||||
|
|
||||||
public bool Equals(CampaignId? other) => other?.Value == Value;
|
|
||||||
public override bool Equals(object? obj) => obj is CampaignId other && Equals(other);
|
|
||||||
public override int GetHashCode() => Value.GetHashCode();
|
|
||||||
public static implicit operator Guid(CampaignId id) => id.Value;
|
public static implicit operator Guid(CampaignId id) => id.Value;
|
||||||
public override string ToString() => Value.ToString();
|
public static implicit operator CampaignId(Guid value) => new CampaignId(value);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user