From 6a5ff79701e68aa6681bee07231b2c91b9f2cb47 Mon Sep 17 00:00:00 2001 From: Nikoo Asadnejad Date: Thu, 11 Jan 2024 10:50:55 +0330 Subject: [PATCH] feat : add baseId --- .../Constants/Messages/ExceptionMessage.cs | 0 .../Exceptions/DomainValidationException.cs | 0 .../Exceptions}/InvalidIpException.cs | 0 Src/Product.Domain/Shared/ValueObjects/BaseId.cs | 15 +++++++++++++++ .../Shared/ValueObjects/CategoryId.cs | 8 ++++++++ .../{Base => Shared/ValueObjects}/Ip.cs | 0 6 files changed, 23 insertions(+) rename Src/Product.Domain/{ => Shared}/Constants/Messages/ExceptionMessage.cs (100%) rename Src/Product.Domain/{ => Shared}/Exceptions/DomainValidationException.cs (100%) rename Src/Product.Domain/{Exceptions/Genrals => Shared/Exceptions}/InvalidIpException.cs (100%) create mode 100644 Src/Product.Domain/Shared/ValueObjects/BaseId.cs create mode 100644 Src/Product.Domain/Shared/ValueObjects/CategoryId.cs rename Src/Product.Domain/{Base => Shared/ValueObjects}/Ip.cs (100%) diff --git a/Src/Product.Domain/Constants/Messages/ExceptionMessage.cs b/Src/Product.Domain/Shared/Constants/Messages/ExceptionMessage.cs similarity index 100% rename from Src/Product.Domain/Constants/Messages/ExceptionMessage.cs rename to Src/Product.Domain/Shared/Constants/Messages/ExceptionMessage.cs diff --git a/Src/Product.Domain/Exceptions/DomainValidationException.cs b/Src/Product.Domain/Shared/Exceptions/DomainValidationException.cs similarity index 100% rename from Src/Product.Domain/Exceptions/DomainValidationException.cs rename to Src/Product.Domain/Shared/Exceptions/DomainValidationException.cs diff --git a/Src/Product.Domain/Exceptions/Genrals/InvalidIpException.cs b/Src/Product.Domain/Shared/Exceptions/InvalidIpException.cs similarity index 100% rename from Src/Product.Domain/Exceptions/Genrals/InvalidIpException.cs rename to Src/Product.Domain/Shared/Exceptions/InvalidIpException.cs diff --git a/Src/Product.Domain/Shared/ValueObjects/BaseId.cs b/Src/Product.Domain/Shared/ValueObjects/BaseId.cs new file mode 100644 index 0000000..a0ce0c2 --- /dev/null +++ b/Src/Product.Domain/Shared/ValueObjects/BaseId.cs @@ -0,0 +1,15 @@ +namespace Product.Domain.Base; + +public class BaseId : ValueObject +{ + public T Id { get; } + + public BaseId(T id) + { + Id = id; + } + protected override IEnumerable GetEqualityComponents() + { + throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Src/Product.Domain/Shared/ValueObjects/CategoryId.cs b/Src/Product.Domain/Shared/ValueObjects/CategoryId.cs new file mode 100644 index 0000000..49504e0 --- /dev/null +++ b/Src/Product.Domain/Shared/ValueObjects/CategoryId.cs @@ -0,0 +1,8 @@ +namespace Product.Domain.Base; + +public class CategoryId : BaseId +{ + public CategoryId(int id) : base(id) + { + } +} \ No newline at end of file diff --git a/Src/Product.Domain/Base/Ip.cs b/Src/Product.Domain/Shared/ValueObjects/Ip.cs similarity index 100% rename from Src/Product.Domain/Base/Ip.cs rename to Src/Product.Domain/Shared/ValueObjects/Ip.cs