//---------------------------------------------------------------------------------------------------
// <auto-generated>
//    This code was generated by BLToolkit template for T4.
//    Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
// </auto-generated>
//---------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;

using BLToolkit.Data;
using BLToolkit.Data.Linq;
using BLToolkit.DataAccess;
using BLToolkit.Mapping;

namespace Linq.Demo.DataModel
{
	public partial class NorthwindDB : DbManager
	{
		public Table<AlphabeticalListOfProduct>  AlphabeticalListOfProduct  { get { return GetTable<AlphabeticalListOfProduct>();  } }
		public Table<Category>                   Category                   { get { return GetTable<Category>();                   } }
		public Table<CategorySalesFor1997>       CategorySalesFor1997       { get { return GetTable<CategorySalesFor1997>();       } }
		public Table<CurrentProductList>         CurrentProductList         { get { return GetTable<CurrentProductList>();         } }
		public Table<CustomerAndSuppliersByCity> CustomerAndSuppliersByCity { get { return GetTable<CustomerAndSuppliersByCity>(); } }
		public Table<CustomerCustomerDemo>       CustomerCustomerDemo       { get { return GetTable<CustomerCustomerDemo>();       } }
		public Table<CustomerDemographic>        CustomerDemographic        { get { return GetTable<CustomerDemographic>();        } }
		public Table<Customer>                   Customer                   { get { return GetTable<Customer>();                   } }
		public Table<Employee>                   Employee                   { get { return GetTable<Employee>();                   } }
		public Table<EmployeeTerritory>          EmployeeTerritory          { get { return GetTable<EmployeeTerritory>();          } }
		public Table<Invoice>                    Invoice                    { get { return GetTable<Invoice>();                    } }
		public Table<OrderDetail>                OrderDetail                { get { return GetTable<OrderDetail>();                } }
		public Table<OrderDetailsExtended>       OrderDetailsExtended       { get { return GetTable<OrderDetailsExtended>();       } }
		public Table<OrderSubtotal>              OrderSubtotal              { get { return GetTable<OrderSubtotal>();              } }
		public Table<Order>                      Order                      { get { return GetTable<Order>();                      } }
		public Table<OrdersQry>                  OrdersQry                  { get { return GetTable<OrdersQry>();                  } }
		public Table<ProductSalesFor1997>        ProductSalesFor1997        { get { return GetTable<ProductSalesFor1997>();        } }
		public Table<Product>                    Product                    { get { return GetTable<Product>();                    } }
		public Table<ProductsAboveAveragePrice>  ProductsAboveAveragePrice  { get { return GetTable<ProductsAboveAveragePrice>();  } }
		public Table<ProductsByCategory>         ProductsByCategory         { get { return GetTable<ProductsByCategory>();         } }
		public Table<QuarterlyOrder>             QuarterlyOrder             { get { return GetTable<QuarterlyOrder>();             } }
		public Table<Region>                     Region                     { get { return GetTable<Region>();                     } }
		public Table<SalesByCategory>            SalesByCategory            { get { return GetTable<SalesByCategory>();            } }
		public Table<SalesTotalsByAmount>        SalesTotalsByAmount        { get { return GetTable<SalesTotalsByAmount>();        } }
		public Table<Shipper>                    Shipper                    { get { return GetTable<Shipper>();                    } }
		public Table<SummaryOfSalesByQuarter>    SummaryOfSalesByQuarter    { get { return GetTable<SummaryOfSalesByQuarter>();    } }
		public Table<SummaryOfSalesByYear>       SummaryOfSalesByYear       { get { return GetTable<SummaryOfSalesByYear>();       } }
		public Table<Supplier>                   Supplier                   { get { return GetTable<Supplier>();                   } }
		public Table<Territory>                  Territory                  { get { return GetTable<Territory>();                  } }
	}

	[TableName(Name="Alphabetical list of products")]
	public partial class AlphabeticalListOfProduct
	{
		           public int      ProductID       { get; set; }
		           public string   ProductName     { get; set; }
		[Nullable] public int?     SupplierID      { get; set; }
		[Nullable] public int?     CategoryID      { get; set; }
		[Nullable] public string   QuantityPerUnit { get; set; }
		[Nullable] public decimal? UnitPrice       { get; set; }
		[Nullable] public short?   UnitsInStock    { get; set; }
		[Nullable] public short?   UnitsOnOrder    { get; set; }
		[Nullable] public short?   ReorderLevel    { get; set; }
		           public bool     Discontinued    { get; set; }
		           public string   CategoryName    { get; set; }
	}

	[TableName(Name="Categories")]
	public partial class Category
	{
		[Identity, PrimaryKey(1)] public int    CategoryID   { get; set; }
		                          public string CategoryName { get; set; }
		[Nullable               ] public string Description  { get; set; }
		[Nullable               ] public byte[] Picture      { get; set; }

		// FK_Products_Categories_BackReference
		[Association(ThisKey="CategoryID", OtherKey="CategoryID")]
		public List<Product> Products { get; set; }
	}

	[TableName(Name="Category Sales for 1997")]
	public partial class CategorySalesFor1997
	{
		           public string   CategoryName  { get; set; }
		[Nullable] public decimal? CategorySales { get; set; }
	}

	[TableName(Name="Current Product List")]
	public partial class CurrentProductList
	{
		[Identity] public int    ProductID   { get; set; }
		           public string ProductName { get; set; }
	}

	[TableName(Name="Customer and Suppliers by City")]
	public partial class CustomerAndSuppliersByCity
	{
		[Nullable] public string City         { get; set; }
		           public string CompanyName  { get; set; }
		[Nullable] public string ContactName  { get; set; }
		           public string Relationship { get; set; }
	}

	[TableName(Name="CustomerCustomerDemo")]
	public partial class CustomerCustomerDemo
	{
		[PrimaryKey(1)] public string CustomerID     { get; set; }
		[PrimaryKey(2)] public string CustomerTypeID { get; set; }

		// FK_CustomerCustomerDemo
		[Association(ThisKey="CustomerTypeID", OtherKey="CustomerTypeID")]
		public CustomerDemographic FK_CustomerCustomerDemo { get; set; }

		// FK_CustomerCustomerDemo_Customers
		[Association(ThisKey="CustomerID", OtherKey="CustomerID")]
		public Customer Customer { get; set; }
	}

	[TableName(Name="CustomerDemographics")]
	public partial class CustomerDemographic
	{
		[          PrimaryKey(1)] public string CustomerTypeID { get; set; }
		[Nullable               ] public string CustomerDesc   { get; set; }

		// FK_CustomerCustomerDemo_BackReference
		[Association(ThisKey="CustomerTypeID", OtherKey="CustomerTypeID")]
		public List<CustomerCustomerDemo> CustomerCustomerDemo { get; set; }
	}

	[TableName(Name="Customers")]
	public partial class Customer
	{
		[          PrimaryKey(1)] public string CustomerID   { get; set; }
		                          public string CompanyName  { get; set; }
		[Nullable               ] public string ContactName  { get; set; }
		[Nullable               ] public string ContactTitle { get; set; }
		[Nullable               ] public string Address      { get; set; }
		[Nullable               ] public string City         { get; set; }
		[Nullable               ] public string Region       { get; set; }
		[Nullable               ] public string PostalCode   { get; set; }
		[Nullable               ] public string Country      { get; set; }
		[Nullable               ] public string Phone        { get; set; }
		[Nullable               ] public string Fax          { get; set; }

		// FK_Orders_Customers_BackReference
		[Association(ThisKey="CustomerID", OtherKey="CustomerID")]
		public List<Order> Orders { get; set; }

		// FK_CustomerCustomerDemo_Customers_BackReference
		[Association(ThisKey="CustomerID", OtherKey="CustomerID")]
		public List<CustomerCustomerDemo> CustomerCustomerDemo { get; set; }
	}

	[TableName(Name="Employees")]
	public partial class Employee
	{
		[Identity, PrimaryKey(1)] public int       EmployeeID      { get; set; }
		                          public string    LastName        { get; set; }
		                          public string    FirstName       { get; set; }
		[Nullable               ] public string    Title           { get; set; }
		[Nullable               ] public string    TitleOfCourtesy { get; set; }
		[Nullable               ] public DateTime? BirthDate       { get; set; }
		[Nullable               ] public DateTime? HireDate        { get; set; }
		[Nullable               ] public string    Address         { get; set; }
		[Nullable               ] public string    City            { get; set; }
		[Nullable               ] public string    Region          { get; set; }
		[Nullable               ] public string    PostalCode      { get; set; }
		[Nullable               ] public string    Country         { get; set; }
		[Nullable               ] public string    HomePhone       { get; set; }
		[Nullable               ] public string    Extension       { get; set; }
		[Nullable               ] public byte[]    Photo           { get; set; }
		[Nullable               ] public string    Notes           { get; set; }
		[Nullable               ] public int?      ReportsTo       { get; set; }
		[Nullable               ] public string    PhotoPath       { get; set; }

		// FK_Employees_Employees
		[Association(ThisKey="ReportsTo", OtherKey="EmployeeID")]
		public Employee ReportsToEmployee { get; set; }

		// FK_Orders_Employees_BackReference
		[Association(ThisKey="EmployeeID", OtherKey="EmployeeID")]
		public List<Order> Orders { get; set; }

		// FK_EmployeeTerritories_Employees_BackReference
		[Association(ThisKey="EmployeeID", OtherKey="EmployeeID")]
		public List<EmployeeTerritory> EmployeeTerritories { get; set; }

		// FK_Employees_Employees_BackReference
		[Association(ThisKey="EmployeeID", OtherKey="ReportsTo")]
		public List<Employee> Reporters { get; set; }
	}

	[TableName(Name="EmployeeTerritories")]
	public partial class EmployeeTerritory
	{
		[PrimaryKey(1)] public int    EmployeeID  { get; set; }
		[PrimaryKey(2)] public string TerritoryID { get; set; }

		// FK_EmployeeTerritories_Employees
		[Association(ThisKey="EmployeeID", OtherKey="EmployeeID")]
		public Employee Employee { get; set; }

		// FK_EmployeeTerritories_Territories
		[Association(ThisKey="TerritoryID", OtherKey="TerritoryID")]
		public Territory Territory { get; set; }
	}

	[TableName(Name="Invoices")]
	public partial class Invoice
	{
		[Nullable] public string    ShipName       { get; set; }
		[Nullable] public string    ShipAddress    { get; set; }
		[Nullable] public string    ShipCity       { get; set; }
		[Nullable] public string    ShipRegion     { get; set; }
		[Nullable] public string    ShipPostalCode { get; set; }
		[Nullable] public string    ShipCountry    { get; set; }
		[Nullable] public string    CustomerID     { get; set; }
		           public string    CustomerName   { get; set; }
		[Nullable] public string    Address        { get; set; }
		[Nullable] public string    City           { get; set; }
		[Nullable] public string    Region         { get; set; }
		[Nullable] public string    PostalCode     { get; set; }
		[Nullable] public string    Country        { get; set; }
		           public string    Salesperson    { get; set; }
		           public int       OrderID        { get; set; }
		[Nullable] public DateTime? OrderDate      { get; set; }
		[Nullable] public DateTime? RequiredDate   { get; set; }
		[Nullable] public DateTime? ShippedDate    { get; set; }
		           public string    ShipperName    { get; set; }
		           public int       ProductID      { get; set; }
		           public string    ProductName    { get; set; }
		           public decimal   UnitPrice      { get; set; }
		           public short     Quantity       { get; set; }
		           public float     Discount       { get; set; }
		[Nullable] public decimal?  ExtendedPrice  { get; set; }
		[Nullable] public decimal?  Freight        { get; set; }
	}

	[TableName(Name="Order Details")]
	public partial class OrderDetail
	{
		[PrimaryKey(1)] public int     OrderID   { get; set; }
		[PrimaryKey(2)] public int     ProductID { get; set; }
		                public decimal UnitPrice { get; set; }
		                public short   Quantity  { get; set; }
		                public float   Discount  { get; set; }

		// FK_Order_Details_Orders
		[Association(ThisKey="OrderID", OtherKey="OrderID")]
		public Order Order { get; set; }

		// FK_Order_Details_Products
		[Association(ThisKey="ProductID", OtherKey="ProductID")]
		public Product Product { get; set; }
	}

	[TableName(Name="Order Details Extended")]
	public partial class OrderDetailsExtended
	{
		           public int      OrderID       { get; set; }
		           public int      ProductID     { get; set; }
		           public string   ProductName   { get; set; }
		           public decimal  UnitPrice     { get; set; }
		           public short    Quantity      { get; set; }
		           public float    Discount      { get; set; }
		[Nullable] public decimal? ExtendedPrice { get; set; }
	}

	[TableName(Name="Order Subtotals")]
	public partial class OrderSubtotal
	{
		           public int      OrderID  { get; set; }
		[Nullable] public decimal? Subtotal { get; set; }
	}

	[TableName(Name="Orders")]
	public partial class Order
	{
		[Identity, PrimaryKey(1)] public int       OrderID        { get; set; }
		[Nullable               ] public string    CustomerID     { get; set; }
		[Nullable               ] public int?      EmployeeID     { get; set; }
		[Nullable               ] public DateTime? OrderDate      { get; set; }
		[Nullable               ] public DateTime? RequiredDate   { get; set; }
		[Nullable               ] public DateTime? ShippedDate    { get; set; }
		[Nullable               ] public int?      ShipVia        { get; set; }
		[Nullable               ] public decimal?  Freight        { get; set; }
		[Nullable               ] public string    ShipName       { get; set; }
		[Nullable               ] public string    ShipAddress    { get; set; }
		[Nullable               ] public string    ShipCity       { get; set; }
		[Nullable               ] public string    ShipRegion     { get; set; }
		[Nullable               ] public string    ShipPostalCode { get; set; }
		[Nullable               ] public string    ShipCountry    { get; set; }

		// FK_Orders_Customers
		[Association(ThisKey="CustomerID", OtherKey="CustomerID")]
		public Customer Customer { get; set; }

		// FK_Orders_Employees
		[Association(ThisKey="EmployeeID", OtherKey="EmployeeID")]
		public Employee Employee { get; set; }

		// FK_Orders_Shippers
		[Association(ThisKey="ShipVia", OtherKey="ShipperID")]
		public Shipper Shipper { get; set; }

		// FK_Order_Details_Orders_BackReference
		[Association(ThisKey="OrderID", OtherKey="OrderID")]
		public List<OrderDetail> OrderDetails { get; set; }
	}

	[TableName(Name="Orders Qry")]
	public partial class OrdersQry
	{
		           public int       OrderID        { get; set; }
		[Nullable] public string    CustomerID     { get; set; }
		[Nullable] public int?      EmployeeID     { get; set; }
		[Nullable] public DateTime? OrderDate      { get; set; }
		[Nullable] public DateTime? RequiredDate   { get; set; }
		[Nullable] public DateTime? ShippedDate    { get; set; }
		[Nullable] public int?      ShipVia        { get; set; }
		[Nullable] public decimal?  Freight        { get; set; }
		[Nullable] public string    ShipName       { get; set; }
		[Nullable] public string    ShipAddress    { get; set; }
		[Nullable] public string    ShipCity       { get; set; }
		[Nullable] public string    ShipRegion     { get; set; }
		[Nullable] public string    ShipPostalCode { get; set; }
		[Nullable] public string    ShipCountry    { get; set; }
		           public string    CompanyName    { get; set; }
		[Nullable] public string    Address        { get; set; }
		[Nullable] public string    City           { get; set; }
		[Nullable] public string    Region         { get; set; }
		[Nullable] public string    PostalCode     { get; set; }
		[Nullable] public string    Country        { get; set; }
	}

	[TableName(Name="Product Sales for 1997")]
	public partial class ProductSalesFor1997
	{
		           public string   CategoryName { get; set; }
		           public string   ProductName  { get; set; }
		[Nullable] public decimal? ProductSales { get; set; }
	}

	[TableName(Name="Products")]
	public partial class Product
	{
		[Identity, PrimaryKey(1)                                           ] public int      ProductID       { get; set; }
		                                                                     public string   ProductName     { get; set; }
		[Nullable                                                          ] public int?     SupplierID      { get; set; }
		[Nullable                                                          ] public int?     CategoryID      { get; set; }
		[Nullable                                                          ] public string   QuantityPerUnit { get; set; }
		[Nullable                                                          ] public decimal? UnitPrice       { get; set; }
		[Nullable                                                          ] public short?   UnitsInStock    { get; set; }
		[Nullable                                                          ] public short?   UnitsOnOrder    { get; set; }
		[Nullable                                                          ] public short?   ReorderLevel    { get; set; }
		[                         MapField(IsInheritanceDiscriminator=true)] public bool     Discontinued    { get; set; }

		// FK_Products_Categories
		[Association(ThisKey="CategoryID", OtherKey="CategoryID")]
		public Category Category { get; set; }

		// FK_Products_Suppliers
		[Association(ThisKey="SupplierID", OtherKey="SupplierID")]
		public Supplier Supplier { get; set; }

		// FK_Order_Details_Products_BackReference
		[Association(ThisKey="ProductID", OtherKey="ProductID")]
		public List<OrderDetail> OrderDetails { get; set; }
	}

	[TableName(Name="Products Above Average Price")]
	public partial class ProductsAboveAveragePrice
	{
		           public string   ProductName { get; set; }
		[Nullable] public decimal? UnitPrice   { get; set; }
	}

	[TableName(Name="Products by Category")]
	public partial class ProductsByCategory
	{
		           public string CategoryName    { get; set; }
		           public string ProductName     { get; set; }
		[Nullable] public string QuantityPerUnit { get; set; }
		[Nullable] public short? UnitsInStock    { get; set; }
		           public bool   Discontinued    { get; set; }
	}

	[TableName(Name="Quarterly Orders")]
	public partial class QuarterlyOrder
	{
		[Nullable] public string CustomerID  { get; set; }
		[Nullable] public string CompanyName { get; set; }
		[Nullable] public string City        { get; set; }
		[Nullable] public string Country     { get; set; }
	}

	[TableName(Name="Region")]
	public partial class Region
	{
		[PrimaryKey(1)] public int    RegionID          { get; set; }
		                public string RegionDescription { get; set; }

		// FK_Territories_Region_BackReference
		[Association(ThisKey="RegionID", OtherKey="RegionID")]
		public List<Territory> Territories { get; set; }
	}

	[TableName(Name="Sales by Category")]
	public partial class SalesByCategory
	{
		           public int      CategoryID   { get; set; }
		           public string   CategoryName { get; set; }
		           public string   ProductName  { get; set; }
		[Nullable] public decimal? ProductSales { get; set; }
	}

	[TableName(Name="Sales Totals by Amount")]
	public partial class SalesTotalsByAmount
	{
		[Nullable] public decimal?  SaleAmount  { get; set; }
		           public int       OrderID     { get; set; }
		           public string    CompanyName { get; set; }
		[Nullable] public DateTime? ShippedDate { get; set; }
	}

	[TableName(Name="Shippers")]
	public partial class Shipper
	{
		[Identity, PrimaryKey(1)] public int    ShipperID   { get; set; }
		                          public string CompanyName { get; set; }
		[Nullable               ] public string Phone       { get; set; }

		// FK_Orders_Shippers_BackReference
		[Association(ThisKey="ShipperID", OtherKey="ShipVia")]
		public List<Order> Orders { get; set; }
	}

	[TableName(Name="Summary of Sales by Quarter")]
	public partial class SummaryOfSalesByQuarter
	{
		[Nullable] public DateTime? ShippedDate { get; set; }
		           public int       OrderID     { get; set; }
		[Nullable] public decimal?  Subtotal    { get; set; }
	}

	[TableName(Name="Summary of Sales by Year")]
	public partial class SummaryOfSalesByYear
	{
		[Nullable] public DateTime? ShippedDate { get; set; }
		           public int       OrderID     { get; set; }
		[Nullable] public decimal?  Subtotal    { get; set; }
	}

	[TableName(Name="Suppliers")]
	public partial class Supplier
	{
		[Identity, PrimaryKey(1)] public int    SupplierID   { get; set; }
		                          public string CompanyName  { get; set; }
		[Nullable               ] public string ContactName  { get; set; }
		[Nullable               ] public string ContactTitle { get; set; }
		[Nullable               ] public string Address      { get; set; }
		[Nullable               ] public string City         { get; set; }
		[Nullable               ] public string Region       { get; set; }
		[Nullable               ] public string PostalCode   { get; set; }
		[Nullable               ] public string Country      { get; set; }
		[Nullable               ] public string Phone        { get; set; }
		[Nullable               ] public string Fax          { get; set; }
		[Nullable               ] public string HomePage     { get; set; }

		// FK_Products_Suppliers_BackReference
		[Association(ThisKey="SupplierID", OtherKey="SupplierID")]
		public List<Product> Products { get; set; }
	}

	[TableName(Name="Territories")]
	public partial class Territory
	{
		[PrimaryKey(1)] public string TerritoryID          { get; set; }
		                public string TerritoryDescription { get; set; }
		                public int    RegionID             { get; set; }

		// FK_Territories_Region
		[Association(ThisKey="RegionID", OtherKey="RegionID")]
		public Region Region { get; set; }

		// FK_EmployeeTerritories_Territories_BackReference
		[Association(ThisKey="TerritoryID", OtherKey="TerritoryID")]
		public List<EmployeeTerritory> EmployeeTerritories { get; set; }
	}
}
