0
|
1 //---------------------------------------------------------------------------------------------------
|
|
2 // <auto-generated>
|
|
3 // This code was generated by BLToolkit template for T4.
|
|
4 // Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
|
|
5 // </auto-generated>
|
|
6 //---------------------------------------------------------------------------------------------------
|
|
7 using System;
|
|
8 using System.Collections.Generic;
|
|
9 using System.Linq;
|
|
10 using System.Linq.Expressions;
|
|
11 using System.Reflection;
|
|
12 using System.Text;
|
|
13
|
|
14 using BLToolkit.Data;
|
|
15 using BLToolkit.Data.DataProvider;
|
|
16 using BLToolkit.Data.Linq;
|
|
17 using BLToolkit.Data.Sql;
|
|
18 using BLToolkit.Data.Sql.SqlProvider;
|
|
19 using BLToolkit.DataAccess;
|
|
20 using BLToolkit.Mapping;
|
|
21
|
|
22 namespace NorthwindDS
|
|
23 {
|
|
24 public partial class DataContext : DbManager
|
|
25 {
|
|
26 public Table<AlphabeticalListOfProduct> AlphabeticalListOfProducts { get { return this.GetTable<AlphabeticalListOfProduct>(); } }
|
|
27 /// <summary>
|
|
28 /// Description for Categories table.
|
|
29 /// </summary>
|
|
30 public Table<Category> Categories { get { return this.GetTable<Category>(); } }
|
|
31 public Table<CategorySalesFor1997> CategorySalesFor1997 { get { return this.GetTable<CategorySalesFor1997>(); } }
|
|
32 public Table<CurrentProductList> CurrentProductLists { get { return this.GetTable<CurrentProductList>(); } }
|
|
33 public Table<CustomerAndSuppliersByCity> CustomerAndSuppliersByCities { get { return this.GetTable<CustomerAndSuppliersByCity>(); } }
|
|
34 public Table<CustomerCustomerDemo> CustomerCustomerDemos { get { return this.GetTable<CustomerCustomerDemo>(); } }
|
|
35 public Table<CustomerDemographic> CustomerDemographics { get { return this.GetTable<CustomerDemographic>(); } }
|
|
36 /// <summary>
|
|
37 /// Description of Customers table.
|
|
38 /// </summary>
|
|
39 public Table<Customer> Customers { get { return this.GetTable<Customer>(); } }
|
|
40 public Table<Employee> Employees { get { return this.GetTable<Employee>(); } }
|
|
41 public Table<EmployeeTerritory> EmployeeTerritories { get { return this.GetTable<EmployeeTerritory>(); } }
|
|
42 public Table<Invoice> Invoices { get { return this.GetTable<Invoice>(); } }
|
|
43 public Table<OrderDetail> OrderDetails { get { return this.GetTable<OrderDetail>(); } }
|
|
44 public Table<OrderDetailsExtended> OrderDetailsExtendeds { get { return this.GetTable<OrderDetailsExtended>(); } }
|
|
45 public Table<OrderSubtotal> OrderSubtotals { get { return this.GetTable<OrderSubtotal>(); } }
|
|
46 public Table<Order> Orders { get { return this.GetTable<Order>(); } }
|
|
47 public Table<OrdersQry> OrdersQries { get { return this.GetTable<OrdersQry>(); } }
|
|
48 public Table<ProductSalesFor1997> ProductSalesFor1997 { get { return this.GetTable<ProductSalesFor1997>(); } }
|
|
49 public Table<Product> Products { get { return this.GetTable<Product>(); } }
|
|
50 public Table<ProductsAboveAveragePrice> ProductsAboveAveragePrices { get { return this.GetTable<ProductsAboveAveragePrice>(); } }
|
|
51 public Table<ProductsByCategory> ProductsByCategories { get { return this.GetTable<ProductsByCategory>(); } }
|
|
52 public Table<QuarterlyOrder> QuarterlyOrders { get { return this.GetTable<QuarterlyOrder>(); } }
|
|
53 public Table<Region> Regions { get { return this.GetTable<Region>(); } }
|
|
54 public Table<SalesByCategory> SalesByCategories { get { return this.GetTable<SalesByCategory>(); } }
|
|
55 public Table<SalesTotalsByAmount> SalesTotalsByAmounts { get { return this.GetTable<SalesTotalsByAmount>(); } }
|
|
56 public Table<Shipper> Shippers { get { return this.GetTable<Shipper>(); } }
|
|
57 public Table<SummaryOfSalesByQuarter> SummaryOfSalesByQuarters { get { return this.GetTable<SummaryOfSalesByQuarter>(); } }
|
|
58 public Table<SummaryOfSalesByYear> SummaryOfSalesByYears { get { return this.GetTable<SummaryOfSalesByYear>(); } }
|
|
59 public Table<Supplier> Suppliers { get { return this.GetTable<Supplier>(); } }
|
|
60 public Table<Territory> Territories { get { return this.GetTable<Territory>(); } }
|
|
61
|
|
62 #region FreeTextTable
|
|
63
|
|
64 public class FreeTextKey<T>
|
|
65 {
|
|
66 public T Key;
|
|
67 public int Rank;
|
|
68 }
|
|
69
|
|
70 class FreeTextTableExpressionAttribute : TableExpressionAttribute
|
|
71 {
|
|
72 public FreeTextTableExpressionAttribute()
|
|
73 : base("")
|
|
74 {
|
|
75 }
|
|
76
|
|
77 public override void SetTable(SqlTable table, MemberInfo member, IEnumerable<Expression> expArgs, IEnumerable<ISqlExpression> sqlArgs)
|
|
78 {
|
|
79 var aargs = sqlArgs.ToArray();
|
|
80 var arr = ConvertArgs(member, aargs).ToList();
|
|
81 var method = (MethodInfo)member;
|
|
82 var sp = new MsSql2008SqlProvider();
|
|
83
|
|
84 {
|
|
85 var ttype = method.GetGenericArguments()[0];
|
|
86 var tbl = new SqlTable(ttype);
|
|
87
|
|
88 var database = tbl.Database == null ? null : sp.Convert(tbl.Database, ConvertType.NameToDatabase). ToString();
|
|
89 var owner = tbl.Owner == null ? null : sp.Convert(tbl.Owner, ConvertType.NameToOwner). ToString();
|
|
90 var physicalName = tbl.PhysicalName == null ? null : sp.Convert(tbl.PhysicalName, ConvertType.NameToQueryTable).ToString();
|
|
91
|
|
92 var name = sp.BuildTableName(new StringBuilder(), database, owner, physicalName);
|
|
93
|
|
94 arr.Add(new SqlExpression(name.ToString(), Precedence.Primary));
|
|
95 }
|
|
96
|
|
97 {
|
|
98 var field = ((ConstantExpression)expArgs.First()).Value;
|
|
99
|
|
100 if (field is string)
|
|
101 {
|
|
102 arr[0] = new SqlExpression(field.ToString(), Precedence.Primary);
|
|
103 }
|
|
104 else if (field is LambdaExpression)
|
|
105 {
|
|
106 var body = ((LambdaExpression)field).Body;
|
|
107
|
|
108 if (body is MemberExpression)
|
|
109 {
|
|
110 var name = ((MemberExpression)body).Member.Name;
|
|
111
|
|
112 name = sp.Convert(name, ConvertType.NameToQueryField).ToString();
|
|
113
|
|
114 arr[0] = new SqlExpression(name, Precedence.Primary);
|
|
115 }
|
|
116 }
|
|
117 }
|
|
118
|
|
119 table.SqlTableType = SqlTableType.Expression;
|
|
120 table.Name = "FREETEXTTABLE({6}, {2}, {3}) {1}";
|
|
121 table.TableArguments = arr.ToArray();
|
|
122 }
|
|
123 }
|
|
124
|
|
125 [FreeTextTableExpressionAttribute]
|
|
126 public Table<FreeTextKey<TKey>> FreeTextTable<TTable,TKey>(string field, string text)
|
|
127 {
|
|
128 return this.GetTable<FreeTextKey<TKey>>(
|
|
129 this,
|
|
130 ((MethodInfo)(MethodBase.GetCurrentMethod())).MakeGenericMethod(typeof(TTable), typeof(TKey)),
|
|
131 field,
|
|
132 text);
|
|
133 }
|
|
134
|
|
135 [FreeTextTableExpressionAttribute]
|
|
136 public Table<FreeTextKey<TKey>> FreeTextTable<TTable,TKey>(Expression<Func<TTable,string>> fieldSelector, string text)
|
|
137 {
|
|
138 return this.GetTable<FreeTextKey<TKey>>(
|
|
139 this,
|
|
140 ((MethodInfo)(MethodBase.GetCurrentMethod())).MakeGenericMethod(typeof(TTable), typeof(TKey)),
|
|
141 fieldSelector,
|
|
142 text);
|
|
143 }
|
|
144
|
|
145 #endregion
|
|
146 }
|
|
147
|
|
148 // View
|
|
149 [TableName(Name="Alphabetical list of products")]
|
|
150 public partial class AlphabeticalListOfProduct
|
|
151 {
|
|
152 public int ProductID { get; set; } // int(10)
|
|
153 public string ProductName { get; set; } // nvarchar(40)
|
|
154 [Nullable] public int? SupplierID { get; set; } // int(10)
|
|
155 [Nullable] public int? CategoryID { get; set; } // int(10)
|
|
156 [Nullable] public string QuantityPerUnit { get; set; } // nvarchar(20)
|
|
157 [Nullable] public decimal? UnitPrice { get; set; } // money(19,4)
|
|
158 [Nullable] public short? UnitsInStock { get; set; } // smallint(5)
|
|
159 [Nullable] public short? UnitsOnOrder { get; set; } // smallint(5)
|
|
160 [Nullable] public short? ReorderLevel { get; set; } // smallint(5)
|
|
161 public bool Discontinued { get; set; } // bit
|
|
162 public string CategoryName { get; set; } // nvarchar(15)
|
|
163 }
|
|
164
|
|
165 /// <summary>
|
|
166 /// Description for Categories table.
|
|
167 /// </summary>
|
|
168 [TableName(Name="Categories")]
|
|
169 public partial class Category
|
|
170 {
|
|
171 /// <summary>
|
|
172 /// Description of Categories.CategoryID field.
|
|
173 /// </summary>
|
|
174 [Identity, PrimaryKey(1)] public int CategoryID { get; set; } // int(10)
|
|
175 public string CategoryName { get; set; } // nvarchar(15)
|
|
176 [Nullable ] public string Description { get; set; } // ntext(1073741823)
|
|
177 [Nullable ] public byte[] Picture { get; set; } // image(2147483647)
|
|
178
|
|
179 // FK_Products_Categories_BackReference
|
|
180 [Association(ThisKey="CategoryID", OtherKey="CategoryID", CanBeNull=true)]
|
|
181 public IEnumerable<Product> Products { get; set; }
|
|
182 }
|
|
183
|
|
184 // View
|
|
185 [TableName(Name="Category Sales for 1997")]
|
|
186 public partial class CategorySalesFor1997
|
|
187 {
|
|
188 public string CategoryName { get; set; } // nvarchar(15)
|
|
189 [Nullable] public decimal? CategorySales { get; set; } // money(19,4)
|
|
190 }
|
|
191
|
|
192 // View
|
|
193 [TableName(Name="Current Product List")]
|
|
194 public partial class CurrentProductList
|
|
195 {
|
|
196 [Identity] public int ProductID { get; set; } // int(10)
|
|
197 public string ProductName { get; set; } // nvarchar(40)
|
|
198 }
|
|
199
|
|
200 // View
|
|
201 [TableName(Name="Customer and Suppliers by City")]
|
|
202 public partial class CustomerAndSuppliersByCity
|
|
203 {
|
|
204 [Nullable] public string City { get; set; } // nvarchar(15)
|
|
205 public string CompanyName { get; set; } // nvarchar(40)
|
|
206 [Nullable] public string ContactName { get; set; } // nvarchar(30)
|
|
207 public string Relationship { get; set; } // varchar(9)
|
|
208 }
|
|
209
|
|
210 [TableName(Name="CustomerCustomerDemo")]
|
|
211 public partial class CustomerCustomerDemo
|
|
212 {
|
|
213 [PrimaryKey(1)] public string CustomerID { get; set; } // nchar(5)
|
|
214 [PrimaryKey(2)] public string CustomerTypeID { get; set; } // nchar(10)
|
|
215
|
|
216 // FK_CustomerCustomerDemo
|
|
217 [Association(ThisKey="CustomerTypeID", OtherKey="CustomerTypeID", CanBeNull=false)]
|
|
218 public CustomerDemographic FK_CustomerCustomerDemo { get; set; }
|
|
219
|
|
220 // FK_CustomerCustomerDemo_Customers
|
|
221 [Association(ThisKey="CustomerID", OtherKey="CustomerID", CanBeNull=false)]
|
|
222 public Customer Customer { get; set; }
|
|
223 }
|
|
224
|
|
225 [TableName(Name="CustomerDemographics")]
|
|
226 public partial class CustomerDemographic
|
|
227 {
|
|
228 [ PrimaryKey(1)] public string CustomerTypeID { get; set; } // nchar(10)
|
|
229 [Nullable ] public string CustomerDesc { get; set; } // ntext(1073741823)
|
|
230
|
|
231 // FK_CustomerCustomerDemo_BackReference
|
|
232 [Association(ThisKey="CustomerTypeID", OtherKey="CustomerTypeID", CanBeNull=true)]
|
|
233 public IEnumerable<CustomerCustomerDemo> CustomerCustomerDemos { get; set; }
|
|
234 }
|
|
235
|
|
236 /// <summary>
|
|
237 /// Description of Customers table.
|
|
238 /// </summary>
|
|
239 [TableName(Name="Customers")]
|
|
240 public partial class Customer
|
|
241 {
|
|
242 /// <summary>
|
|
243 /// Just ID.
|
|
244 /// </summary>
|
|
245 [ PrimaryKey(1)] public string CustomerID { get; set; } // nchar(5)
|
|
246 /// <summary>
|
|
247 /// Name of the Company.
|
|
248 /// </summary>
|
|
249 public string CompanyName { get; set; } // nvarchar(40)
|
|
250 [Nullable ] public string ContactName { get; set; } // nvarchar(30)
|
|
251 [Nullable ] public string ContactTitle { get; set; } // nvarchar(30)
|
|
252 [Nullable ] public string Address { get; set; } // nvarchar(60)
|
|
253 [Nullable ] public string City { get; set; } // nvarchar(15)
|
|
254 [Nullable ] public string Region { get; set; } // nvarchar(15)
|
|
255 [Nullable ] public string PostalCode { get; set; } // nvarchar(10)
|
|
256 [Nullable ] public string Country { get; set; } // nvarchar(15)
|
|
257 [Nullable ] public string Phone { get; set; } // nvarchar(24)
|
|
258 [Nullable ] public string Fax { get; set; } // nvarchar(24)
|
|
259
|
|
260 // FK_Orders_Customers_BackReference
|
|
261 [Association(ThisKey="CustomerID", OtherKey="CustomerID", CanBeNull=true)]
|
|
262 public IEnumerable<Order> Orders { get; set; }
|
|
263
|
|
264 // FK_CustomerCustomerDemo_Customers_BackReference
|
|
265 [Association(ThisKey="CustomerID", OtherKey="CustomerID", CanBeNull=true)]
|
|
266 public IEnumerable<CustomerCustomerDemo> CustomerCustomerDemos { get; set; }
|
|
267 }
|
|
268
|
|
269 [TableName(Name="Employees")]
|
|
270 public partial class Employee
|
|
271 {
|
|
272 [Identity, PrimaryKey(1)] public int EmployeeID { get; set; } // int(10)
|
|
273 public string LastName { get; set; } // nvarchar(20)
|
|
274 public string FirstName { get; set; } // nvarchar(10)
|
|
275 [Nullable ] public string Title { get; set; } // nvarchar(30)
|
|
276 [Nullable ] public string TitleOfCourtesy { get; set; } // nvarchar(25)
|
|
277 [Nullable ] public DateTime? BirthDate { get; set; } // datetime(3)
|
|
278 [Nullable ] public DateTime? HireDate { get; set; } // datetime(3)
|
|
279 [Nullable ] public string Address { get; set; } // nvarchar(60)
|
|
280 [Nullable ] public string City { get; set; } // nvarchar(15)
|
|
281 [Nullable ] public string Region { get; set; } // nvarchar(15)
|
|
282 [Nullable ] public string PostalCode { get; set; } // nvarchar(10)
|
|
283 [Nullable ] public string Country { get; set; } // nvarchar(15)
|
|
284 [Nullable ] public string HomePhone { get; set; } // nvarchar(24)
|
|
285 [Nullable ] public string Extension { get; set; } // nvarchar(4)
|
|
286 [Nullable ] public byte[] Photo { get; set; } // image(2147483647)
|
|
287 [Nullable ] public string Notes { get; set; } // ntext(1073741823)
|
|
288 [Nullable ] public int? ReportsTo { get; set; } // int(10)
|
|
289 [Nullable ] public string PhotoPath { get; set; } // nvarchar(255)
|
|
290
|
|
291 // FK_Employees_Employees
|
|
292 [Association(ThisKey="ReportsTo", OtherKey="EmployeeID", CanBeNull=true)]
|
|
293 public Employee FK_Employees_Employees { get; set; }
|
|
294
|
|
295 // FK_Orders_Employees_BackReference
|
|
296 [Association(ThisKey="EmployeeID", OtherKey="EmployeeID", CanBeNull=true)]
|
|
297 public IEnumerable<Order> Orders { get; set; }
|
|
298
|
|
299 // FK_EmployeeTerritories_Employees_BackReference
|
|
300 [Association(ThisKey="EmployeeID", OtherKey="EmployeeID", CanBeNull=true)]
|
|
301 public IEnumerable<EmployeeTerritory> EmployeeTerritories { get; set; }
|
|
302
|
|
303 // FK_Employees_Employees_BackReference
|
|
304 [Association(ThisKey="EmployeeID", OtherKey="ReportsTo", CanBeNull=true)]
|
|
305 public IEnumerable<Employee> FK_Employees_Employees_BackReference { get; set; }
|
|
306 }
|
|
307
|
|
308 [TableName(Name="EmployeeTerritories")]
|
|
309 public partial class EmployeeTerritory
|
|
310 {
|
|
311 [PrimaryKey(1)] public int EmployeeID { get; set; } // int(10)
|
|
312 [PrimaryKey(2)] public string TerritoryID { get; set; } // nvarchar(20)
|
|
313
|
|
314 // FK_EmployeeTerritories_Employees
|
|
315 [Association(ThisKey="EmployeeID", OtherKey="EmployeeID", CanBeNull=false)]
|
|
316 public Employee Employee { get; set; }
|
|
317
|
|
318 // FK_EmployeeTerritories_Territories
|
|
319 [Association(ThisKey="TerritoryID", OtherKey="TerritoryID", CanBeNull=false)]
|
|
320 public Territory Territory { get; set; }
|
|
321 }
|
|
322
|
|
323 // View
|
|
324 [TableName(Name="Invoices")]
|
|
325 public partial class Invoice
|
|
326 {
|
|
327 [Nullable] public string ShipName { get; set; } // nvarchar(40)
|
|
328 [Nullable] public string ShipAddress { get; set; } // nvarchar(60)
|
|
329 [Nullable] public string ShipCity { get; set; } // nvarchar(15)
|
|
330 [Nullable] public string ShipRegion { get; set; } // nvarchar(15)
|
|
331 [Nullable] public string ShipPostalCode { get; set; } // nvarchar(10)
|
|
332 [Nullable] public string ShipCountry { get; set; } // nvarchar(15)
|
|
333 [Nullable] public string CustomerID { get; set; } // nchar(5)
|
|
334 public string CustomerName { get; set; } // nvarchar(40)
|
|
335 [Nullable] public string Address { get; set; } // nvarchar(60)
|
|
336 [Nullable] public string City { get; set; } // nvarchar(15)
|
|
337 [Nullable] public string Region { get; set; } // nvarchar(15)
|
|
338 [Nullable] public string PostalCode { get; set; } // nvarchar(10)
|
|
339 [Nullable] public string Country { get; set; } // nvarchar(15)
|
|
340 public string Salesperson { get; set; } // nvarchar(31)
|
|
341 public int OrderID { get; set; } // int(10)
|
|
342 [Nullable] public DateTime? OrderDate { get; set; } // datetime(3)
|
|
343 [Nullable] public DateTime? RequiredDate { get; set; } // datetime(3)
|
|
344 [Nullable] public DateTime? ShippedDate { get; set; } // datetime(3)
|
|
345 public string ShipperName { get; set; } // nvarchar(40)
|
|
346 public int ProductID { get; set; } // int(10)
|
|
347 public string ProductName { get; set; } // nvarchar(40)
|
|
348 public decimal UnitPrice { get; set; } // money(19,4)
|
|
349 public short Quantity { get; set; } // smallint(5)
|
|
350 public float Discount { get; set; } // real(24)
|
|
351 [Nullable] public decimal? ExtendedPrice { get; set; } // money(19,4)
|
|
352 [Nullable] public decimal? Freight { get; set; } // money(19,4)
|
|
353 }
|
|
354
|
|
355 [TableName(Name="Order Details")]
|
|
356 public partial class OrderDetail
|
|
357 {
|
|
358 [PrimaryKey(1)] public int OrderID { get; set; } // int(10)
|
|
359 [PrimaryKey(2)] public int ProductID { get; set; } // int(10)
|
|
360 public decimal UnitPrice { get; set; } // money(19,4)
|
|
361 public short Quantity { get; set; } // smallint(5)
|
|
362 public float Discount { get; set; } // real(24)
|
|
363
|
|
364 // FK_Order_Details_Orders
|
|
365 [Association(ThisKey="OrderID", OtherKey="OrderID", CanBeNull=false)]
|
|
366 public Order OrderDetailsOrder { get; set; }
|
|
367
|
|
368 // FK_Order_Details_Products
|
|
369 [Association(ThisKey="ProductID", OtherKey="ProductID", CanBeNull=false)]
|
|
370 public Product OrderDetailsProduct { get; set; }
|
|
371 }
|
|
372
|
|
373 // View
|
|
374 [TableName(Name="Order Details Extended")]
|
|
375 public partial class OrderDetailsExtended
|
|
376 {
|
|
377 public int OrderID { get; set; } // int(10)
|
|
378 public int ProductID { get; set; } // int(10)
|
|
379 public string ProductName { get; set; } // nvarchar(40)
|
|
380 public decimal UnitPrice { get; set; } // money(19,4)
|
|
381 public short Quantity { get; set; } // smallint(5)
|
|
382 public float Discount { get; set; } // real(24)
|
|
383 [Nullable] public decimal? ExtendedPrice { get; set; } // money(19,4)
|
|
384 }
|
|
385
|
|
386 // View
|
|
387 [TableName(Name="Order Subtotals")]
|
|
388 public partial class OrderSubtotal
|
|
389 {
|
|
390 public int OrderID { get; set; } // int(10)
|
|
391 [Nullable] public decimal? Subtotal { get; set; } // money(19,4)
|
|
392 }
|
|
393
|
|
394 [TableName(Name="Orders")]
|
|
395 public partial class Order
|
|
396 {
|
|
397 [Identity, PrimaryKey(1)] public int OrderID { get; set; } // int(10)
|
|
398 [Nullable ] public string CustomerID { get; set; } // nchar(5)
|
|
399 [Nullable ] public int? EmployeeID { get; set; } // int(10)
|
|
400 [Nullable ] public DateTime? OrderDate { get; set; } // datetime(3)
|
|
401 [Nullable ] public DateTime? RequiredDate { get; set; } // datetime(3)
|
|
402 [Nullable ] public DateTime? ShippedDate { get; set; } // datetime(3)
|
|
403 [Nullable ] public int? ShipVia { get; set; } // int(10)
|
|
404 [Nullable ] public decimal? Freight { get; set; } // money(19,4)
|
|
405 [Nullable ] public string ShipName { get; set; } // nvarchar(40)
|
|
406 [Nullable ] public string ShipAddress { get; set; } // nvarchar(60)
|
|
407 [Nullable ] public string ShipCity { get; set; } // nvarchar(15)
|
|
408 [Nullable ] public string ShipRegion { get; set; } // nvarchar(15)
|
|
409 [Nullable ] public string ShipPostalCode { get; set; } // nvarchar(10)
|
|
410 [Nullable ] public string ShipCountry { get; set; } // nvarchar(15)
|
|
411
|
|
412 // FK_Orders_Shippers
|
|
413 [Association(ThisKey="ShipVia", OtherKey="ShipperID", CanBeNull=true)]
|
|
414 public Shipper Shipper { get; set; }
|
|
415
|
|
416 // FK_Orders_Employees
|
|
417 [Association(ThisKey="EmployeeID", OtherKey="EmployeeID", CanBeNull=true)]
|
|
418 public Employee Employee { get; set; }
|
|
419
|
|
420 // FK_Orders_Customers
|
|
421 [Association(ThisKey="CustomerID", OtherKey="CustomerID", CanBeNull=true)]
|
|
422 public Customer Customer { get; set; }
|
|
423
|
|
424 // FK_Order_Details_Orders_BackReference
|
|
425 [Association(ThisKey="OrderID", OtherKey="OrderID", CanBeNull=true)]
|
|
426 public IEnumerable<OrderDetail> OrderDetails { get; set; }
|
|
427 }
|
|
428
|
|
429 // View
|
|
430 [TableName(Name="Orders Qry")]
|
|
431 public partial class OrdersQry
|
|
432 {
|
|
433 public int OrderID { get; set; } // int(10)
|
|
434 [Nullable] public string CustomerID { get; set; } // nchar(5)
|
|
435 [Nullable] public int? EmployeeID { get; set; } // int(10)
|
|
436 [Nullable] public DateTime? OrderDate { get; set; } // datetime(3)
|
|
437 [Nullable] public DateTime? RequiredDate { get; set; } // datetime(3)
|
|
438 [Nullable] public DateTime? ShippedDate { get; set; } // datetime(3)
|
|
439 [Nullable] public int? ShipVia { get; set; } // int(10)
|
|
440 [Nullable] public decimal? Freight { get; set; } // money(19,4)
|
|
441 [Nullable] public string ShipName { get; set; } // nvarchar(40)
|
|
442 [Nullable] public string ShipAddress { get; set; } // nvarchar(60)
|
|
443 [Nullable] public string ShipCity { get; set; } // nvarchar(15)
|
|
444 [Nullable] public string ShipRegion { get; set; } // nvarchar(15)
|
|
445 [Nullable] public string ShipPostalCode { get; set; } // nvarchar(10)
|
|
446 [Nullable] public string ShipCountry { get; set; } // nvarchar(15)
|
|
447 public string CompanyName { get; set; } // nvarchar(40)
|
|
448 [Nullable] public string Address { get; set; } // nvarchar(60)
|
|
449 [Nullable] public string City { get; set; } // nvarchar(15)
|
|
450 [Nullable] public string Region { get; set; } // nvarchar(15)
|
|
451 [Nullable] public string PostalCode { get; set; } // nvarchar(10)
|
|
452 [Nullable] public string Country { get; set; } // nvarchar(15)
|
|
453 }
|
|
454
|
|
455 // View
|
|
456 [TableName(Name="Product Sales for 1997")]
|
|
457 public partial class ProductSalesFor1997
|
|
458 {
|
|
459 public string CategoryName { get; set; } // nvarchar(15)
|
|
460 public string ProductName { get; set; } // nvarchar(40)
|
|
461 [Nullable] public decimal? ProductSales { get; set; } // money(19,4)
|
|
462 }
|
|
463
|
|
464 [TableName(Name="Products")]
|
|
465 public partial class Product
|
|
466 {
|
|
467 [Identity, PrimaryKey(1) ] public int ProductID { get; set; } // int(10)
|
|
468 public string ProductName { get; set; } // nvarchar(40)
|
|
469 [Nullable ] public int? SupplierID { get; set; } // int(10)
|
|
470 [Nullable ] public int? CategoryID { get; set; } // int(10)
|
|
471 [Nullable ] public string QuantityPerUnit { get; set; } // nvarchar(20)
|
|
472 [Nullable ] public decimal? UnitPrice { get; set; } // money(19,4)
|
|
473 [Nullable ] public short? UnitsInStock { get; set; } // smallint(5)
|
|
474 [Nullable ] public short? UnitsOnOrder { get; set; } // smallint(5)
|
|
475 [Nullable ] public short? ReorderLevel { get; set; } // smallint(5)
|
|
476 [ MapField(IsInheritanceDiscriminator=true)] public bool Discontinued { get; set; } // bit
|
|
477
|
|
478 // FK_Products_Suppliers
|
|
479 [Association(ThisKey="SupplierID", OtherKey="SupplierID", CanBeNull=true)]
|
|
480 public Supplier Supplier { get; set; }
|
|
481
|
|
482 // FK_Products_Categories
|
|
483 [Association(ThisKey="CategoryID", OtherKey="CategoryID", CanBeNull=true)]
|
|
484 public Category Category { get; set; }
|
|
485
|
|
486 // FK_Order_Details_Products_BackReference
|
|
487 [Association(ThisKey="ProductID", OtherKey="ProductID", CanBeNull=true)]
|
|
488 public IEnumerable<OrderDetail> OrderDetails { get; set; }
|
|
489 }
|
|
490
|
|
491 // View
|
|
492 [TableName(Name="Products Above Average Price")]
|
|
493 public partial class ProductsAboveAveragePrice
|
|
494 {
|
|
495 public string ProductName { get; set; } // nvarchar(40)
|
|
496 [Nullable] public decimal? UnitPrice { get; set; } // money(19,4)
|
|
497 }
|
|
498
|
|
499 // View
|
|
500 [TableName(Name="Products by Category")]
|
|
501 public partial class ProductsByCategory
|
|
502 {
|
|
503 public string CategoryName { get; set; } // nvarchar(15)
|
|
504 public string ProductName { get; set; } // nvarchar(40)
|
|
505 [Nullable] public string QuantityPerUnit { get; set; } // nvarchar(20)
|
|
506 [Nullable] public short? UnitsInStock { get; set; } // smallint(5)
|
|
507 public bool Discontinued { get; set; } // bit
|
|
508 }
|
|
509
|
|
510 // View
|
|
511 [TableName(Name="Quarterly Orders")]
|
|
512 public partial class QuarterlyOrder
|
|
513 {
|
|
514 [Nullable] public string CustomerID { get; set; } // nchar(5)
|
|
515 [Nullable] public string CompanyName { get; set; } // nvarchar(40)
|
|
516 [Nullable] public string City { get; set; } // nvarchar(15)
|
|
517 [Nullable] public string Country { get; set; } // nvarchar(15)
|
|
518 }
|
|
519
|
|
520 [TableName(Name="Region")]
|
|
521 public partial class Region
|
|
522 {
|
|
523 [PrimaryKey(1)] public int RegionID { get; set; } // int(10)
|
|
524 public string RegionDescription { get; set; } // nchar(50)
|
|
525
|
|
526 // FK_Territories_Region_BackReference
|
|
527 [Association(ThisKey="RegionID", OtherKey="RegionID", CanBeNull=true)]
|
|
528 public IEnumerable<Territory> Territories { get; set; }
|
|
529 }
|
|
530
|
|
531 // View
|
|
532 [TableName(Name="Sales by Category")]
|
|
533 public partial class SalesByCategory
|
|
534 {
|
|
535 public int CategoryID { get; set; } // int(10)
|
|
536 public string CategoryName { get; set; } // nvarchar(15)
|
|
537 public string ProductName { get; set; } // nvarchar(40)
|
|
538 [Nullable] public decimal? ProductSales { get; set; } // money(19,4)
|
|
539 }
|
|
540
|
|
541 // View
|
|
542 [TableName(Name="Sales Totals by Amount")]
|
|
543 public partial class SalesTotalsByAmount
|
|
544 {
|
|
545 [Nullable] public decimal? SaleAmount { get; set; } // money(19,4)
|
|
546 public int OrderID { get; set; } // int(10)
|
|
547 public string CompanyName { get; set; } // nvarchar(40)
|
|
548 [Nullable] public DateTime? ShippedDate { get; set; } // datetime(3)
|
|
549 }
|
|
550
|
|
551 [TableName(Name="Shippers")]
|
|
552 public partial class Shipper
|
|
553 {
|
|
554 [Identity, PrimaryKey(1)] public int ShipperID { get; set; } // int(10)
|
|
555 public string CompanyName { get; set; } // nvarchar(40)
|
|
556 [Nullable ] public string Phone { get; set; } // nvarchar(24)
|
|
557
|
|
558 // FK_Orders_Shippers_BackReference
|
|
559 [Association(ThisKey="ShipperID", OtherKey="ShipVia", CanBeNull=true)]
|
|
560 public IEnumerable<Order> Orders { get; set; }
|
|
561 }
|
|
562
|
|
563 // View
|
|
564 [TableName(Name="Summary of Sales by Quarter")]
|
|
565 public partial class SummaryOfSalesByQuarter
|
|
566 {
|
|
567 [Nullable] public DateTime? ShippedDate { get; set; } // datetime(3)
|
|
568 public int OrderID { get; set; } // int(10)
|
|
569 [Nullable] public decimal? Subtotal { get; set; } // money(19,4)
|
|
570 }
|
|
571
|
|
572 // View
|
|
573 [TableName(Name="Summary of Sales by Year")]
|
|
574 public partial class SummaryOfSalesByYear
|
|
575 {
|
|
576 [Nullable] public DateTime? ShippedDate { get; set; } // datetime(3)
|
|
577 public int OrderID { get; set; } // int(10)
|
|
578 [Nullable] public decimal? Subtotal { get; set; } // money(19,4)
|
|
579 }
|
|
580
|
|
581 [TableName(Name="Suppliers")]
|
|
582 public partial class Supplier
|
|
583 {
|
|
584 [Identity, PrimaryKey(1)] public int SupplierID { get; set; } // int(10)
|
|
585 public string CompanyName { get; set; } // nvarchar(40)
|
|
586 [Nullable ] public string ContactName { get; set; } // nvarchar(30)
|
|
587 [Nullable ] public string ContactTitle { get; set; } // nvarchar(30)
|
|
588 [Nullable ] public string Address { get; set; } // nvarchar(60)
|
|
589 [Nullable ] public string City { get; set; } // nvarchar(15)
|
|
590 [Nullable ] public string Region { get; set; } // nvarchar(15)
|
|
591 [Nullable ] public string PostalCode { get; set; } // nvarchar(10)
|
|
592 [Nullable ] public string Country { get; set; } // nvarchar(15)
|
|
593 [Nullable ] public string Phone { get; set; } // nvarchar(24)
|
|
594 [Nullable ] public string Fax { get; set; } // nvarchar(24)
|
|
595 [Nullable ] public string HomePage { get; set; } // ntext(1073741823)
|
|
596
|
|
597 // FK_Products_Suppliers_BackReference
|
|
598 [Association(ThisKey="SupplierID", OtherKey="SupplierID", CanBeNull=true)]
|
|
599 public IEnumerable<Product> Products { get; set; }
|
|
600 }
|
|
601
|
|
602 [TableName(Name="Territories")]
|
|
603 public partial class Territory
|
|
604 {
|
|
605 [PrimaryKey(1)] public string TerritoryID { get; set; } // nvarchar(20)
|
|
606 public string TerritoryDescription { get; set; } // nchar(50)
|
|
607 public int RegionID { get; set; } // int(10)
|
|
608
|
|
609 // FK_Territories_Region
|
|
610 [Association(ThisKey="RegionID", OtherKey="RegionID", CanBeNull=false)]
|
|
611 public Region Region { get; set; }
|
|
612
|
|
613 // FK_EmployeeTerritories_Territories_BackReference
|
|
614 [Association(ThisKey="TerritoryID", OtherKey="TerritoryID", CanBeNull=true)]
|
|
615 public IEnumerable<EmployeeTerritory> EmployeeTerritories { get; set; }
|
|
616 }
|
|
617 }
|