Commit 031150b4 authored by O'Reilly Media, Inc.'s avatar O'Reilly Media, Inc.
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading
+49 −0
Changes for Code_CS/C10_LINQ/App_Code/AwltCustomer.dbml: 49 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<Database Name="AdventureWorksLT" Class="AwltCustomersDataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
  <Connection Mode="WebSettings" ConnectionString="Data Source=PRECISION\sql2k5;Initial Catalog=AdventureWorksLT;Integrated Security=True" SettingsObjectName="System.Configuration.ConfigurationManager.ConnectionStrings" SettingsPropertyName="AdventureWorksLTConnectionString" Provider="System.Data.SqlClient" />
  <Table Name="SalesLT.Customer" Member="Customers">
    <Type Name="Customer">
      <Column Name="CustomerID" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
      <Column Name="NameStyle" Type="System.Boolean" DbType="Bit NOT NULL" CanBeNull="false" />
      <Column Name="Title" Type="System.String" DbType="NVarChar(8)" CanBeNull="true" />
      <Column Name="FirstName" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
      <Column Name="MiddleName" Type="System.String" DbType="NVarChar(50)" CanBeNull="true" />
      <Column Name="LastName" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
      <Column Name="Suffix" Type="System.String" DbType="NVarChar(10)" CanBeNull="true" />
      <Column Name="CompanyName" Type="System.String" DbType="NVarChar(128)" CanBeNull="true" />
      <Column Name="SalesPerson" Type="System.String" DbType="NVarChar(256)" CanBeNull="true" />
      <Column Name="EmailAddress" Type="System.String" DbType="NVarChar(50)" CanBeNull="true" />
      <Column Name="Phone" Type="System.String" DbType="NVarChar(25)" CanBeNull="true" />
      <Column Name="PasswordHash" Type="System.String" DbType="VarChar(128) NOT NULL" CanBeNull="false" />
      <Column Name="PasswordSalt" Type="System.String" DbType="VarChar(10) NOT NULL" CanBeNull="false" />
      <Column Name="rowguid" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
      <Column Name="ModifiedDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
      <Association Name="Customer_CustomerAddress" Member="CustomerAddresses" OtherKey="CustomerID" Type="CustomerAddress" />
    </Type>
  </Table>
  <Table Name="SalesLT.CustomerAddress" Member="CustomerAddresses">
    <Type Name="CustomerAddress">
      <Column Name="CustomerID" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="AddressID" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
      <Column Name="AddressType" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
      <Column Name="rowguid" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
      <Column Name="ModifiedDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
      <Association Name="Customer_CustomerAddress" Member="Customer" ThisKey="CustomerID" Type="Customer" IsForeignKey="true" />
      <Association Name="Address_CustomerAddress" Member="Address" ThisKey="AddressID" Type="Address" IsForeignKey="true" />
    </Type>
  </Table>
  <Table Name="SalesLT.Address" Member="Addresses">
    <Type Name="Address">
      <Column Name="AddressID" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
      <Column Name="AddressLine1" Type="System.String" DbType="NVarChar(60) NOT NULL" CanBeNull="false" />
      <Column Name="AddressLine2" Type="System.String" DbType="NVarChar(60)" CanBeNull="true" />
      <Column Name="City" Type="System.String" DbType="NVarChar(30) NOT NULL" CanBeNull="false" />
      <Column Name="StateProvince" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
      <Column Name="CountryRegion" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
      <Column Name="PostalCode" Type="System.String" DbType="NVarChar(15) NOT NULL" CanBeNull="false" />
      <Column Name="rowguid" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
      <Column Name="ModifiedDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
      <Association Name="Address_CustomerAddress" Member="CustomerAddresses" OtherKey="AddressID" Type="CustomerAddress" />
    </Type>
  </Table>
</Database>
 No newline at end of file
+38 −0
Changes for Code_CS/C10_LINQ/App_Code/AwltCustomer.dbml.layout: 38 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<ordesignerObjectsDiagram dslVersion="1.0.0.0" absoluteBounds="0, 0, 11, 8.5" name="AwltCustomers">
  <DataContextMoniker Name="/AwltCustomersDataContext" />
  <nestedChildShapes>
    <classShape Id="7ce496d2-eaa1-4f4a-ba81-146d6ff4d546" absoluteBounds="4.75, 1.125, 2, 3.23266845703125">
      <DataClassMoniker Name="/AwltCustomersDataContext/Customer" />
      <nestedChildShapes>
        <elementListCompartment Id="1b29a5c2-0dd9-4356-b973-80e72f2118b2" absoluteBounds="4.7650000000000006, 1.585, 1.9700000000000002, 2.67266845703125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
      </nestedChildShapes>
    </classShape>
    <classShape Id="350b9acc-50ad-4d64-b4db-a8286d8b7fd2" absoluteBounds="2.125, 3.5, 2, 1.5891951497395831">
      <DataClassMoniker Name="/AwltCustomersDataContext/CustomerAddress" />
      <nestedChildShapes>
        <elementListCompartment Id="3b69fdb6-f7da-4a12-8bb1-e6421fa963ac" absoluteBounds="2.14, 3.96, 1.9700000000000002, 1.0291951497395833" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
      </nestedChildShapes>
    </classShape>
    <associationConnector edgePoints="[(4.75 : 3.92883422851563); (4.125 : 3.92883422851563)]" fixedFrom="Algorithm" fixedTo="Algorithm">
      <AssociationMoniker Name="/AwltCustomersDataContext/Customer/Customer_CustomerAddress" />
      <nodes>
        <classShapeMoniker Id="7ce496d2-eaa1-4f4a-ba81-146d6ff4d546" />
        <classShapeMoniker Id="350b9acc-50ad-4d64-b4db-a8286d8b7fd2" />
      </nodes>
    </associationConnector>
    <classShape Id="f62ec21e-fd9a-4531-9440-22fddf3094a9" absoluteBounds="0.5, 0.5, 2, 2.24658447265625">
      <DataClassMoniker Name="/AwltCustomersDataContext/Address" />
      <nestedChildShapes>
        <elementListCompartment Id="dc676423-ac6f-44bf-a7ca-def11651cafc" absoluteBounds="0.515, 0.96, 1.9700000000000002, 1.68658447265625" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
      </nestedChildShapes>
    </classShape>
    <associationConnector edgePoints="[(2.3125 : 2.74658447265625); (2.3125 : 3.5)]" fixedFrom="Algorithm" fixedTo="Algorithm">
      <AssociationMoniker Name="/AwltCustomersDataContext/Address/Address_CustomerAddress" />
      <nodes>
        <classShapeMoniker Id="f62ec21e-fd9a-4531-9440-22fddf3094a9" />
        <classShapeMoniker Id="350b9acc-50ad-4d64-b4db-a8286d8b7fd2" />
      </nodes>
    </associationConnector>
  </nestedChildShapes>
</ordesignerObjectsDiagram>
 No newline at end of file
+1045 −0

File added.

Preview size limit exceeded, changes collapsed.

+27 −0
Changes for Code_CS/C10_LINQ/App_Code/Book.cs: 27 added lines, 0 removed lines.
Original line number Diff line number Diff line
using System;
using System.Collections.Generic;

public class Book
{
   public string ISBN { get; set; }
   public string Title { get; set; }
   public decimal Price { get; set; }
   public DateTime ReleaseDate { get; set; }

   public static List<Book> GetBookList()
   {
      List<Book> list = new List<Book>();
      list.Add(new Book { ISBN = "0596529562", ReleaseDate = Convert.ToDateTime("2008-07-15"), 
         Price = 30.0m, Title = "Programming ASP.NET 3.5" });
      list.Add(new Book { ISBN = "059652756X", ReleaseDate = Convert.ToDateTime("2008-06-15"), 
         Price = 26.0m, Title = "Programming .NET 3.5" });
      list.Add(new Book { ISBN = "0596518455", ReleaseDate = Convert.ToDateTime("2008-07-15"), 
         Price = 28.0m, Title = "Learning ASP.NET 3.5" });
      list.Add(new Book { ISBN = "0596518439", ReleaseDate = Convert.ToDateTime("2008-03-15"), 
         Price = 25.0m, Title = "Programming Visual Basic 2008" });
      list.Add(new Book { ISBN = "0596527438", ReleaseDate = Convert.ToDateTime("2008-01-15"), 
         Price = 31.0m, Title = "Programming C# 3.0" });

      return list;
   }
}
+23 −0
Changes for Code_CS/C10_LINQ/App_Code/BookStats.cs: 23 added lines, 0 removed lines.
Original line number Diff line number Diff line
using System.Collections.Generic;
using System.Linq;

public class BookStats
{
   public int Sales { get; set; }
   public int Pages { get; set; }
   public int Rank { get; set; }
   public string ISBN { get; set; }

   public static IEnumerable<BookStats> GetBookStats()
   {
      BookStats[] stats = {
         new BookStats { ISBN = "0596529562", Pages=904, Rank=1, Sales=109000},
         new BookStats { ISBN = "0596527438", Pages=607, Rank=2, Sales=58000},
         new BookStats { ISBN = "059652756X", Pages=704, Rank=3, Sales=75000},
         new BookStats { ISBN = "0596518455", Pages=552, Rank=4, Sales=120000},
         new BookStats { ISBN = "0596518439", Pages=752, Rank=5, Sales=37500}
      };

      return stats.OfType<BookStats>();
   }
}
Loading