mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2025-12-06 05:32:03 +01:00
46 lines
1.5 KiB
C#
46 lines
1.5 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.ComponentModel.DataAnnotations;
|
|||
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|||
|
|
using Microsoft.EntityFrameworkCore;
|
|||
|
|
|
|||
|
|
namespace Packt.Shared
|
|||
|
|
{
|
|||
|
|
[Index("CategoryId", Name = "CategoriesProducts")]
|
|||
|
|
[Index("CategoryId", Name = "CategoryId")]
|
|||
|
|
[Index("ProductName", Name = "ProductName")]
|
|||
|
|
[Index("SupplierId", Name = "SupplierId")]
|
|||
|
|
[Index("SupplierId", Name = "SuppliersProducts")]
|
|||
|
|
public partial class Product
|
|||
|
|
{
|
|||
|
|
public Product()
|
|||
|
|
{
|
|||
|
|
OrderDetails = new HashSet<OrderDetail>();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[Key]
|
|||
|
|
public int ProductId { get; set; }
|
|||
|
|
[StringLength(40)]
|
|||
|
|
public string ProductName { get; set; } = null!;
|
|||
|
|
public int? SupplierId { get; set; }
|
|||
|
|
public int? CategoryId { get; set; }
|
|||
|
|
[StringLength(20)]
|
|||
|
|
public string? QuantityPerUnit { get; set; }
|
|||
|
|
[Column(TypeName = "money")]
|
|||
|
|
public decimal? UnitPrice { get; set; }
|
|||
|
|
public short? UnitsInStock { get; set; }
|
|||
|
|
public short? UnitsOnOrder { get; set; }
|
|||
|
|
public short? ReorderLevel { get; set; }
|
|||
|
|
public bool Discontinued { get; set; }
|
|||
|
|
|
|||
|
|
[ForeignKey("CategoryId")]
|
|||
|
|
[InverseProperty("Products")]
|
|||
|
|
public virtual Category? Category { get; set; }
|
|||
|
|
[ForeignKey("SupplierId")]
|
|||
|
|
[InverseProperty("Products")]
|
|||
|
|
public virtual Supplier? Supplier { get; set; }
|
|||
|
|
[InverseProperty("Product")]
|
|||
|
|
public virtual ICollection<OrderDetail> OrderDetails { get; set; }
|
|||
|
|
}
|
|||
|
|
}
|