using System; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using Util.Domain.Entities; namespace Util.Tests.Models; /// /// 订单明细 /// [Description( "订单明细" )] public class OrderItem : EntityBase { /// /// 初始化订单明细 /// public OrderItem() : this( Guid.Empty ) { } /// /// 初始化订单明细 /// /// 订单明细标识 public OrderItem( Guid id ) : base( id ) { } /// /// 订单标识 /// [Description( "订单标识" )] [Required( ErrorMessage = "订单标识不能为空" )] [MaxLength( 256 )] public string OrderId { get; set; } /// /// 产品标识 /// [Description( "产品标识" )] public Guid? ProductId { get; set; } /// /// 产品名称 /// [Description( "产品名称" )] [MaxLength( 500 )] public string ProductName { get; set; } /// /// 单价 /// [Description( "单价" )] public decimal Price { get; set; } /// /// 数量 /// [Description( "数量" )] public int Quantity { get; set; } /// /// 订单 /// public Order Order { get; set; } /// /// 添加变更列表 /// protected override void AddChanges( OrderItem other ) { AddChange( t => t.OrderId, other.OrderId ); AddChange( t => t.ProductId, other.ProductId ); AddChange( t => t.ProductName, other.ProductName ); AddChange( t => t.Price, other.Price ); AddChange( t => t.Quantity, other.Quantity ); } }