mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2026-04-07 23:33:50 +00:00
Initial commit
This commit is contained in:
parent
01d6ccf414
commit
dd097904c2
54 changed files with 37154 additions and 0 deletions
26
vscode/Chapter10/Ch10Ex02DataSerialization/Product.cs
Normal file
26
vscode/Chapter10/Ch10Ex02DataSerialization/Product.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using System.ComponentModel.DataAnnotations; // [Required], [StringLength]
|
||||
using System.ComponentModel.DataAnnotations.Schema; // [Column]
|
||||
|
||||
namespace Packt.Shared;
|
||||
|
||||
public class Product
|
||||
{
|
||||
public int ProductId { get; set; } // primary key
|
||||
|
||||
[Required]
|
||||
[StringLength(40)]
|
||||
public string ProductName { get; set; } = null!;
|
||||
|
||||
[Column("UnitPrice", TypeName = "money")]
|
||||
public decimal? Cost { get; set; } // property name != column name
|
||||
|
||||
[Column("UnitsInStock")]
|
||||
public short? Stock { get; set; }
|
||||
|
||||
public bool Discontinued { get; set; }
|
||||
|
||||
// these two define the foreign key relationship
|
||||
// to the Categories table
|
||||
public int CategoryId { get; set; }
|
||||
public virtual Category Category { get; set; } = null!;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue