foramttierung
This commit is contained in:
@@ -1,7 +0,0 @@
|
|||||||
namespace Webshop.Domain
|
|
||||||
{
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,9 +4,6 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
|
|
||||||
namespace Webshop.Domain.Entities;
|
namespace Webshop.Domain.Entities;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 1. Das zentrale Modell für deine Verkaufsartikel.
|
|
||||||
/// </summary>
|
|
||||||
public class Product
|
public class Product
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
@@ -22,18 +19,13 @@ public class Product
|
|||||||
[MaxLength(500)]
|
[MaxLength(500)]
|
||||||
public string? ShortDescription { get; set; }
|
public string? ShortDescription { get; set; }
|
||||||
|
|
||||||
// Unique-Constraint wird typischerweise via Fluent API konfiguriert:
|
|
||||||
// modelBuilder.Entity<Product>().HasIndex(p => p.SKU).IsUnique();
|
|
||||||
[Required]
|
[Required]
|
||||||
[MaxLength(50)]
|
[MaxLength(50)]
|
||||||
public string SKU { get; set; }
|
public string SKU { get; set; }
|
||||||
|
|
||||||
// Precision wird typischerweise via Fluent API konfiguriert:
|
|
||||||
// modelBuilder.Entity<Product>().Property(p => p.Price).HasPrecision(18, 2);
|
|
||||||
[Required]
|
[Required]
|
||||||
public decimal Price { get; set; }
|
public decimal Price { get; set; }
|
||||||
|
|
||||||
// modelBuilder.Entity<Product>().Property(p => p.OldPrice).HasPrecision(18, 2);
|
|
||||||
public decimal? OldPrice { get; set; }
|
public decimal? OldPrice { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
@@ -45,23 +37,18 @@ public class Product
|
|||||||
[Required]
|
[Required]
|
||||||
public int StockQuantity { get; set; }
|
public int StockQuantity { get; set; }
|
||||||
|
|
||||||
// modelBuilder.Entity<Product>().Property(p => p.Weight).HasPrecision(18, 3);
|
|
||||||
public decimal? Weight { get; set; }
|
public decimal? Weight { get; set; }
|
||||||
|
|
||||||
// modelBuilder.Entity<Product>().Property(p => p.Width).HasPrecision(18, 2);
|
|
||||||
public decimal? Width { get; set; }
|
public decimal? Width { get; set; }
|
||||||
|
|
||||||
// modelBuilder.Entity<Product>().Property(p => p.Height).HasPrecision(18, 2);
|
|
||||||
public decimal? Height { get; set; }
|
public decimal? Height { get; set; }
|
||||||
|
|
||||||
// modelBuilder.Entity<Product>().Property(p => p.Length).HasPrecision(18, 2);
|
|
||||||
public decimal? Length { get; set; }
|
public decimal? Length { get; set; }
|
||||||
|
|
||||||
[MaxLength(2000)]
|
[MaxLength(2000)]
|
||||||
public string? ImageUrl { get; set; }
|
public string? ImageUrl { get; set; }
|
||||||
|
|
||||||
// Unique-Constraint wird typischerweise via Fluent API konfiguriert:
|
|
||||||
// modelBuilder.Entity<Product>().HasIndex(p => p.Slug).IsUnique();
|
|
||||||
[Required]
|
[Required]
|
||||||
[MaxLength(255)]
|
[MaxLength(255)]
|
||||||
public string Slug { get; set; }
|
public string Slug { get; set; }
|
||||||
@@ -74,10 +61,8 @@ public class Product
|
|||||||
[ForeignKey(nameof(Supplier))]
|
[ForeignKey(nameof(Supplier))]
|
||||||
public Guid? SupplierId { get; set; }
|
public Guid? SupplierId { get; set; }
|
||||||
|
|
||||||
// modelBuilder.Entity<Product>().Property(p => p.PurchasePrice).HasPrecision(18, 2);
|
|
||||||
public decimal? PurchasePrice { get; set; }
|
public decimal? PurchasePrice { get; set; }
|
||||||
|
|
||||||
// Navigation Properties
|
|
||||||
public virtual Supplier? Supplier { get; set; }
|
public virtual Supplier? Supplier { get; set; }
|
||||||
public virtual ICollection<ProductVariant> Variants { get; set; } = new List<ProductVariant>();
|
public virtual ICollection<ProductVariant> Variants { get; set; } = new List<ProductVariant>();
|
||||||
public virtual ICollection<Review> Reviews { get; set; } = new List<Review>();
|
public virtual ICollection<Review> Reviews { get; set; } = new List<Review>();
|
||||||
|
|||||||
Reference in New Issue
Block a user