Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Minor improvements

KrzysztofPajak00f71db45eda
diff --git a/src/Core/Grand.Domain/BaseEntity.cs b/src/Core/Grand.Domain/BaseEntity.cs
index c0ea4638e..82b2e17fd 100644
--- a/src/Core/Grand.Domain/BaseEntity.cs
+++ b/src/Core/Grand.Domain/BaseEntity.cs
@@ -6,7 +6,7 @@ namespace Grand.Domain
/// <summary>
/// Base class for entities
/// </summary>
- public abstract partial class BaseEntity: ParentEntity
+ public abstract partial class BaseEntity : ParentEntity
{
protected BaseEntity()
{
@@ -14,6 +14,6 @@ namespace Grand.Domain
}
public IList<UserField> UserFields { get; set; }
-
+
}
}
diff --git a/src/Core/Grand.Domain/Data/UniqueIdentifier.cs b/src/Core/Grand.Domain/Data/UniqueIdentifier.cs
new file mode 100644
index 000000000..a0f2fe142
--- /dev/null
+++ b/src/Core/Grand.Domain/Data/UniqueIdentifier.cs
@@ -0,0 +1,9 @@
+using MongoDB.Bson;
+
+namespace Grand.Domain.Data
+{
+ public static class UniqueIdentifier
+ {
+ public static string New => ObjectId.GenerateNewId().ToString();
+ }
+}
diff --git a/src/Core/Grand.Domain/ParentEntity.cs b/src/Core/Grand.Domain/ParentEntity.cs
index 3d856c7de..a5e84bfdf 100644
--- a/src/Core/Grand.Domain/ParentEntity.cs
+++ b/src/Core/Grand.Domain/ParentEntity.cs
@@ -1,4 +1,4 @@
-using MongoDB.Bson;
+using Grand.Domain.Data;
namespace Grand.Domain
{
@@ -6,7 +6,7 @@ namespace Grand.Domain
{
protected ParentEntity()
{
- _id = ObjectId.GenerateNewId().ToString();
+ _id = UniqueIdentifier.New;
}
public string Id
@@ -15,7 +15,7 @@ namespace Grand.Domain
set
{
if (string.IsNullOrEmpty(value))
- _id = ObjectId.GenerateNewId().ToString();
+ _id = UniqueIdentifier.New;
else
_id = value;
}