comparison Tools/Templates/MSSqlDataModel.generated.cs @ 0:f990fcb411a9

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