mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2026-04-04 22:07:39 +00:00
Initial commit
This commit is contained in:
parent
01d6ccf414
commit
dd097904c2
54 changed files with 37154 additions and 0 deletions
24
vscode/Chapter10/Ch10Ex02DataSerialization/Category.cs
Normal file
24
vscode/Chapter10/Ch10Ex02DataSerialization/Category.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using System.ComponentModel.DataAnnotations.Schema; // [Column]
|
||||
|
||||
namespace Packt.Shared;
|
||||
|
||||
public class Category
|
||||
{
|
||||
// these properties map to columns in the database
|
||||
public int CategoryId { get; set; }
|
||||
|
||||
public string? CategoryName { get; set; }
|
||||
|
||||
[Column(TypeName = "ntext")]
|
||||
public string? Description { get; set; }
|
||||
|
||||
// defines a navigation property for related rows
|
||||
public virtual ICollection<Product> Products { get; set; }
|
||||
|
||||
public Category()
|
||||
{
|
||||
// to enable developers to add products to a Category we must
|
||||
// initialize the navigation property to an empty collection
|
||||
Products = new HashSet<Product>();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue