46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace Webshop.Domain.Entities;
|
|
|
|
/// <summary>
|
|
/// Für Produkte mit unterschiedlichen Attributen (z.B. Größe, Farbe) und eigenem Lagerbestand.
|
|
/// </summary>
|
|
public class ProductVariant
|
|
{
|
|
[Key]
|
|
public Guid Id { get; set; }
|
|
|
|
[Required]
|
|
[ForeignKey(nameof(Product))]
|
|
public Guid ProductId { get; set; }
|
|
|
|
[Required]
|
|
[MaxLength(100)]
|
|
public string Name { get; set; } // z.B. "Farbe", "Größe"
|
|
|
|
[Required]
|
|
[MaxLength(100)]
|
|
public string Value { get; set; } // z.B. "Rot", "XL"
|
|
|
|
// Unique-Constraint wird typischerweise via Fluent API konfiguriert
|
|
[MaxLength(50)]
|
|
public string? SKU { get; set; }
|
|
|
|
// Precision wird via Fluent API konfiguriert
|
|
[Required]
|
|
public decimal PriceAdjustment { get; set; }
|
|
|
|
[Required]
|
|
public int StockQuantity { get; set; }
|
|
|
|
[MaxLength(2000)]
|
|
public string? ImageUrl { get; set; }
|
|
|
|
[Required]
|
|
public bool IsActive { get; set; }
|
|
|
|
// Navigation Property
|
|
public virtual Product Product { get; set; }
|
|
} |