Initial commit

This commit is contained in:
Mark J Price 2022-03-13 16:17:01 +00:00
parent 1d9d051759
commit 9656378279
557 changed files with 182300 additions and 0 deletions

View file

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Packt.Shared
{
[Index("CategoryName", Name = "CategoryName")]
public partial class Category
{
public Category()
{
Products = new HashSet<Product>();
}
[Key]
public int CategoryId { get; set; }
[Required]
[Column(TypeName = "nvarchar (15)")]
[StringLength(15)]
public string CategoryName { get; set; } = null!;
[Column(TypeName = "ntext")]
public string? Description { get; set; }
[Column(TypeName = "image")]
public byte[]? Picture { get; set; }
[InverseProperty("Category")]
public virtual ICollection<Product> Products { get; set; }
}
}

View file

@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization; // [XmlIgnore]
using Microsoft.EntityFrameworkCore;
namespace Packt.Shared
{
[Index("City", Name = "City")]
[Index("CompanyName", Name = "CompanyNameCustomers")]
[Index("PostalCode", Name = "PostalCodeCustomers")]
[Index("Region", Name = "Region")]
public partial class Customer
{
public Customer()
{
Orders = new HashSet<Order>();
}
[Key]
[Column(TypeName = "nchar (5)")]
[StringLength(5)]
[RegularExpression("[A-Z]{5}")]
public string CustomerId { get; set; } = null!;
[Column(TypeName = "nvarchar (40)")]
[StringLength(40)]
public string CompanyName { get; set; } = null!;
[Column(TypeName = "nvarchar (30)")]
[StringLength(30)]
public string? ContactName { get; set; }
[Column(TypeName = "nvarchar (30)")]
[StringLength(30)]
public string? ContactTitle { get; set; }
[Column(TypeName = "nvarchar (60)")]
[StringLength(60)]
public string? Address { get; set; }
[Column(TypeName = "nvarchar (15)")]
[StringLength(15)]
public string? City { get; set; }
[Column(TypeName = "nvarchar (15)")]
[StringLength(15)]
public string? Region { get; set; }
[Column(TypeName = "nvarchar (10)")]
[StringLength(10)]
public string? PostalCode { get; set; }
[Column(TypeName = "nvarchar (15)")]
[StringLength(15)]
public string? Country { get; set; }
[Column(TypeName = "nvarchar (24)")]
[StringLength(24)]
public string? Phone { get; set; }
[Column(TypeName = "nvarchar (24)")]
[StringLength(24)]
public string? Fax { get; set; }
[InverseProperty("Customer")]
[XmlIgnore]
public virtual ICollection<Order> Orders { get; set; }
}
}

View file

@ -0,0 +1,88 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Packt.Shared
{
[Index("LastName", Name = "LastName")]
[Index("PostalCode", Name = "PostalCodeEmployees")]
public partial class Employee
{
public Employee()
{
Orders = new HashSet<Order>();
}
[Key]
public int EmployeeId { get; set; }
[Required]
[Column(TypeName = "nvarchar (20)")]
[StringLength(20)]
public string LastName { get; set; } = null!;
[Required]
[Column(TypeName = "nvarchar (10)")]
[StringLength(10)]
public string FirstName { get; set; } = null!;
[Column(TypeName = "nvarchar (30)")]
[StringLength(30)]
public string? Title { get; set; }
[Column(TypeName = "nvarchar (25)")]
[StringLength(25)]
public string? TitleOfCourtesy { get; set; }
[Column(TypeName = "datetime")]
public DateTime? BirthDate { get; set; }
[Column(TypeName = "datetime")]
public DateTime? HireDate { get; set; }
[Column(TypeName = "nvarchar (60)")]
[StringLength(60)]
public string? Address { get; set; }
[Column(TypeName = "nvarchar (15)")]
[StringLength(15)]
public string? City { get; set; }
[Column(TypeName = "nvarchar (15)")]
[StringLength(15)]
public string? Region { get; set; }
[Column(TypeName = "nvarchar (10)")]
[StringLength(10)]
public string? PostalCode { get; set; }
[Column(TypeName = "nvarchar (15)")]
[StringLength(15)]
public string? Country { get; set; }
[Column(TypeName = "nvarchar (24)")]
[StringLength(24)]
public string? HomePhone { get; set; }
[Column(TypeName = "nvarchar (4)")]
[StringLength(4)]
public string? Extension { get; set; }
[Column(TypeName = "image")]
public byte[]? Photo { get; set; }
[Column(TypeName = "ntext")]
public string? Notes { get; set; }
[Column(TypeName = "int")]
public int? ReportsTo { get; set; }
[Column(TypeName = "nvarchar (255)")]
[StringLength(255)]
public string? PhotoPath { get; set; }
[InverseProperty("Employee")]
public virtual ICollection<Order> Orders { get; set; }
}
}

View file

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Packt.Shared
{
[Keyless]
public partial class EmployeeTerritory
{
[Column(TypeName = "int")]
public int EmployeeId { get; set; }
[Required]
[Column(TypeName = "nvarchar")]
public string TerritoryId { get; set; } = null!;
}
}

View file

@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Using Include="System.Console" Static="true" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0-*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0-*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>

View file

@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Packt.Shared
{
[Index("CustomerId", Name = "CustomerId")]
[Index("CustomerId", Name = "CustomersOrders")]
[Index("EmployeeId", Name = "EmployeeId")]
[Index("EmployeeId", Name = "EmployeesOrders")]
[Index("OrderDate", Name = "OrderDate")]
[Index("ShipPostalCode", Name = "ShipPostalCode")]
[Index("ShippedDate", Name = "ShippedDate")]
[Index("ShipVia", Name = "ShippersOrders")]
public partial class Order
{
public Order()
{
OrderDetails = new HashSet<OrderDetail>();
}
[Key]
public int OrderId { get; set; }
[Column(TypeName = "nchar (5)")]
[StringLength(5)]
[RegularExpression("[A-Z]{5}")]
public string? CustomerId { get; set; }
[Column(TypeName = "int")]
public int? EmployeeId { get; set; }
[Column(TypeName = "datetime")]
public DateTime? OrderDate { get; set; }
[Column(TypeName = "datetime")]
public DateTime? RequiredDate { get; set; }
[Column(TypeName = "datetime")]
public DateTime? ShippedDate { get; set; }
[Column(TypeName = "int")]
public int? ShipVia { get; set; }
[Column(TypeName = "money")]
public decimal? Freight { get; set; }
[Column(TypeName = "nvarchar (40)")]
[StringLength(40)]
public string? ShipName { get; set; }
[Column(TypeName = "nvarchar (60)")]
[StringLength(60)]
public string? ShipAddress { get; set; }
[Column(TypeName = "nvarchar (15)")]
[StringLength(15)]
public string? ShipCity { get; set; }
[Column(TypeName = "nvarchar (15)")]
[StringLength(15)]
public string? ShipRegion { get; set; }
[Column(TypeName = "nvarchar (10)")]
[StringLength(10)]
public string? ShipPostalCode { get; set; }
[Column(TypeName = "nvarchar (15)")]
[StringLength(15)]
public string? ShipCountry { get; set; }
[ForeignKey("CustomerId")]
[InverseProperty("Orders")]
public virtual Customer? Customer { get; set; }
[ForeignKey("EmployeeId")]
[InverseProperty("Orders")]
public virtual Employee? Employee { get; set; }
[ForeignKey("ShipVia")]
[InverseProperty("Orders")]
public virtual Shipper? ShipViaNavigation { get; set; }
[InverseProperty("Order")]
public virtual ICollection<OrderDetail> OrderDetails { get; set; }
}
}

View file

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Packt.Shared
{
[Table("Order Details")]
[Index("OrderId", Name = "OrderId")]
[Index("OrderId", Name = "OrdersOrder_Details")]
[Index("ProductId", Name = "ProductId")]
[Index("ProductId", Name = "ProductsOrder_Details")]
public partial class OrderDetail
{
[Key]
[Column(TypeName = "int")]
public int OrderId { get; set; }
[Key]
[Column(TypeName = "int")]
public int ProductId { get; set; }
[Column(TypeName = "money")]
public decimal? UnitPrice { get; set; } = null!;
[Column(TypeName = "smallint")]
public short Quantity { get; set; }
[Column(TypeName = "real")]
public double Discount { get; set; }
[ForeignKey("OrderId")]
[InverseProperty("OrderDetails")]
public virtual Order Order { get; set; } = null!;
[ForeignKey("ProductId")]
[InverseProperty("OrderDetails")]
public virtual Product Product { get; set; } = null!;
}
}

View file

@ -0,0 +1,61 @@
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; }
[Required]
[Column(TypeName = "nvarchar (40)")]
[StringLength(40)]
public string ProductName { get; set; } = null!;
[Column(TypeName = "int")]
public int? SupplierId { get; set; }
[Column(TypeName = "int")]
public int? CategoryId { get; set; }
[Column(TypeName = "nvarchar (20)")]
[StringLength(20)]
public string? QuantityPerUnit { get; set; }
[Column(TypeName = "money")]
public decimal? UnitPrice { get; set; }
[Column(TypeName = "smallint")]
public short? UnitsInStock { get; set; }
[Column(TypeName = "smallint")]
public short? UnitsOnOrder { get; set; }
[Column(TypeName = "smallint")]
public short? ReorderLevel { get; set; }
[Column(TypeName = "bit")]
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; }
}
}

View file

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Packt.Shared
{
public partial class Shipper
{
public Shipper()
{
Orders = new HashSet<Order>();
}
[Key]
public int ShipperId { get; set; }
[Required]
[Column(TypeName = "nvarchar (40)")]
[StringLength(40)]
public string CompanyName { get; set; } = null!;
[Column(TypeName = "nvarchar (24)")]
[StringLength(24)]
public string? Phone { get; set; }
[InverseProperty("ShipViaNavigation")]
public virtual ICollection<Order> Orders { get; set; }
}
}

View file

@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Packt.Shared
{
[Index("CompanyName", Name = "CompanyNameSuppliers")]
[Index("PostalCode", Name = "PostalCodeSuppliers")]
public partial class Supplier
{
public Supplier()
{
Products = new HashSet<Product>();
}
[Key]
public int SupplierId { get; set; }
[Required]
[Column(TypeName = "nvarchar (40)")]
[StringLength(40)]
public string CompanyName { get; set; } = null!;
[Column(TypeName = "nvarchar (30)")]
[StringLength(30)]
public string? ContactName { get; set; }
[Column(TypeName = "nvarchar (30)")]
[StringLength(30)]
public string? ContactTitle { get; set; }
[Column(TypeName = "nvarchar (60)")]
[StringLength(60)]
public string? Address { get; set; }
[Column(TypeName = "nvarchar (15)")]
[StringLength(15)]
public string? City { get; set; }
[Column(TypeName = "nvarchar (15)")]
[StringLength(15)]
public string? Region { get; set; }
[Column(TypeName = "nvarchar (10)")]
[StringLength(10)]
public string? PostalCode { get; set; }
[Column(TypeName = "nvarchar (15)")]
[StringLength(15)]
public string? Country { get; set; }
[Column(TypeName = "nvarchar (24)")]
[StringLength(24)]
public string? Phone { get; set; }
[Column(TypeName = "nvarchar (24)")]
[StringLength(24)]
public string? Fax { get; set; }
[Column(TypeName = "ntext")]
public string? HomePage { get; set; }
[InverseProperty("Supplier")]
public virtual ICollection<Product> Products { get; set; }
}
}

View file

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Packt.Shared
{
[Keyless]
public partial class Territory
{
[Required]
[Column(TypeName = "nvarchar")]
public string TerritoryId { get; set; } = null!;
[Required]
[Column(TypeName = "nchar")]
public string TerritoryDescription { get; set; } = null!;
[Column(TypeName = "int")]
public int RegionId { get; set; }
}
}