From 7bcd601035f3604abcde86d6b9e05c4d3ad5fab7 Mon Sep 17 00:00:00 2001 From: Loretta Date: Wed, 14 Jan 2026 21:05:20 +0100 Subject: [PATCH] Add ToonDescription attributes for enhanced metadata support Introduced Toon serialization/description attributes to CustomerDto, GenericAttribute, and OrderNote classes. Added table mapping and foreign key metadata, as well as necessary using statements, to improve serialization, documentation, and tooling capabilities. --- Mango.Nop.Core/Dtos/CustomerDto.cs | 7 ++++++- .../NopDependencies/Catalogs/GenericAttribute.cs | 6 +++++- Mango.Nop.Core/NopDependencies/Catalogs/OrderNote.cs | 5 ++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Mango.Nop.Core/Dtos/CustomerDto.cs b/Mango.Nop.Core/Dtos/CustomerDto.cs index 8888248..bc9df76 100644 --- a/Mango.Nop.Core/Dtos/CustomerDto.cs +++ b/Mango.Nop.Core/Dtos/CustomerDto.cs @@ -1,8 +1,13 @@ -using Nop.Core.Domain.Common; +using AyCode.Core.Serializers.Toons; +using Nop.Core.Domain.Catalog; +using Nop.Core.Domain.Common; using Nop.Core.Domain.Customers; namespace Mango.Nop.Core.Dtos; +[LinqToDB.Mapping.Table(Name = nameof(Customer))] +[System.ComponentModel.DataAnnotations.Schema.Table(nameof(Customer))] +[ToonDescription($"Data transfer object for {nameof(Customer)}", TypeRelation = ToonTypeRelation.DtoOf, RelatedTypes = [typeof(Customer)])] public class CustomerDto : ModelDtoBase, ISoftDeletedEntity { public string Username { get; set; } diff --git a/Mango.Nop.Core/NopDependencies/Catalogs/GenericAttribute.cs b/Mango.Nop.Core/NopDependencies/Catalogs/GenericAttribute.cs index ff0b6cb..48368ca 100644 --- a/Mango.Nop.Core/NopDependencies/Catalogs/GenericAttribute.cs +++ b/Mango.Nop.Core/NopDependencies/Catalogs/GenericAttribute.cs @@ -1,4 +1,6 @@ -namespace Nop.Core.Domain.Common; +using AyCode.Core.Serializers.Toons; + +namespace Nop.Core.Domain.Common; /// /// Represents a generic attribute @@ -8,6 +10,8 @@ public partial class GenericAttribute : BaseEntity /// /// Gets or sets the entity identifier /// + /// + [ToonDescription(Constraints = "polymorphic-fk(KeyGroup)")] public int EntityId { get; set; } /// diff --git a/Mango.Nop.Core/NopDependencies/Catalogs/OrderNote.cs b/Mango.Nop.Core/NopDependencies/Catalogs/OrderNote.cs index 4228e77..eb1a8e4 100644 --- a/Mango.Nop.Core/NopDependencies/Catalogs/OrderNote.cs +++ b/Mango.Nop.Core/NopDependencies/Catalogs/OrderNote.cs @@ -1,4 +1,6 @@ -namespace Nop.Core.Domain.Orders; +using AyCode.Core.Serializers.Toons; + +namespace Nop.Core.Domain.Orders; /// /// Represents an order note @@ -8,6 +10,7 @@ public partial class OrderNote : BaseEntity /// /// Gets or sets the order identifier /// + [ToonDescription($"Foreign key to parent {nameof(Order)}", ForeignKey = nameof(Order))] public int OrderId { get; set; } ///