Commit 4e8e2f48 authored by O'Reilly Media, Inc.'s avatar O'Reilly Media, Inc.
Browse files

Initial commit

parents

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
Programming Microsoft ASP.NET MVC == Table of Contents
PART I: THE PROGRAMMING PARADIGM
Chapter 1: Goals of ASP.NET MVC and Motivation for Its Development
The Deep Impact of ASP.NET
Productivity Is King
The Web Forms Model
The “Page Controller” Pattern
The ASP.NET Age of Reason
ASP.NET’s Signs of Aging
The Turning Point
ASP.NET MVC at a Glance
ASP.NET MVC Highlights
Web Forms vs. ASP.NET MVC
Summary
Chapter 2: The Runtime Environment
The ASP.NET Runtime Machinery
ASP.NET and the IIS Web Server
Life Cycle of an ASP.NET Request
What’s an HTTP Handler, Anyway?
What’s an HTTP Module, Anyway?
URL Routing
The ASP.NET MVC Run-Time Shell
The Big Picture
Processing an ASP.NET MVC Request
Summary
Chapter 3: The MVC Pattern and Beyond
The Original MVC Pattern
MVC Interaction Model
The Original Idea
Presenting the Actors
Limitations of the MVC Pattern
The Model2 Pattern
MVC and the Web
Model2 and ASP.NET MVC
Presentation-Oriented Variations of MVC
The MVP Pattern
Presentation Model Pattern (Also Known as MVVM)
The ASP.NET MVC Project Template
Peculiarities of an ASP.NET MVC Project
ASP.NET MVC Special Folders
Summary
PART II: THE CORE OF ASP.NET MVC
Chapter 4: Inside Controllers
The Role of Controllers and the Motivation for Using Them
Beyond the Code-Behind Approach
Introducing Controllers
Mechanics of Controllers in ASP.NET MVC
Anatomy of an ASP.NET MVC Controller
Inside the Structure of a Controller
Behavior of a Controller
Attributes of Controllers and Action Methods
Writing a Controller
Design of a Controller Class
Should You Use Your Own Base Class?
Special Capabilities
Grouping Controllers
Asynchronous Controllers
Render Actions
Controllers and Testability
Making Controllers Easy to Test
Writing Unit Tests
Summary
Chapter 5: Inside Views
Views and Controllers
From Controllers to Views
Building the Response for the Browser
Anatomy of an ASP.NET MVC View
Selecting the View
Creating the View
The Default View Engine
The Web Forms View Engine
Writing a View
The View’s Template
Filling Up the View
HTML Helpers
Templated HTML Helpers
Datagrids and Paged Views
Testing a View
Summary
Chapter 6: Inside Models
What’s the Model, Anyway?
How Many Types of Models Do You Know?
The Models Folder
Domain Model and View-Model
Business Object Modeling
Adding Validation Logic to the Model
Data for the View
Model Binding
The Model Binder in Action
Summary
PART III: PROGRAMMING FEATURES
Chapter 7: Data Entry in ASP.NET MVC
The Select-Edit-Save Pattern
Presenting Data
Editing Data
Saving Data
Data Validation
Validation on the Server Side
Giving Feedback to the User
Data Annotations and Validators
Client-Side Validation
Summary
Chapter 8: The ASP.NET MVC Infrastructure
Routing
Dealing with Routes
Keeping an Eye on SEO
Error Handling
Foundations of ASP.NET Error Handling
Dealing with Missing Content
Localization
Making Resources Localizable
Dealing with Resources in ASP.NET MVC
Dependency Injection
Dependency Inversion in Action
A Brief Tour of Unity
Creating a Global Container
Summary
Chapter 9: AJAX Capabilities
AJAX in ASP.NET
Partial Rendering
Direct Scripting
AJAX in ASP.NET MVC
The JavaScript API
The Controller Façade
AJAX Helpers in ASP.NET MVC
Partial Rendering in ASP.NET MVC
Summary
Chapter 10: Testability and Unit Testing
Testability and Design
Design for Testability
Loosen Up Your Design
Basics of Unit Testing
Working with a Test Harness
Aspects of Testing
Unit Testing in ASP.NET MVC
Testing Controller Actions
Injecting Mocks and Fakes
Mocking the HTTP Context
More Specific Tests
Summary
Chapter 11: Customizing ASP.NET MVC
The Controller Factory
ASP.NET MVC Request Processing
Extending the Default Controller Factory
Invoking Actions
Action Filters
Gallery of Action Filters
Loading Action Filters Dynamically
Action Selectors
Action Results and Rendering
Processing the Result of the Action
Custom ActionResult Objects
View Engines
HTML Helpers
Summary
Appendix: ReSharper and the Power of Tools
___________________________________________________________________
Sample Customization Readme
for
Programming Microsoft ASP.NET MVC
by Dino Esposito
Copyright (c) 2010 by Microsoft Corporation
Portions copyright (c) 2010 by Dino Esposito
All Rights Reserved
___________________________________________________________________
=================================
CUSTOMIZING THE SAMPLE
=================================
1) The sample application may be compiled with either Visual Studio 2010 (MvcGallery.sln) or Visual Studio 2008 (MvcGallery2008.sln). In both cases, Visual Studio must be combined with ASP.NET MVC 2. You may download a trial version of Visual Studio 2010 from the following URL:
http://www.microsoft.com/visualstudio/en-us/products/2010-editions/ultimate
ASP.NET MVC 2 may be downloaded from this URL:
http://www.microsoft.com/downloads/details.aspx?familyid=C9BA1FE1-3BA8-439A-9E21-DEF90A8615A9&displaylang=en
2) The sample uses information contained within the Northwind database. If you do not have the Northwind database, you can download it from the following URL:
http://www.microsoft.com/downloads/details.aspx?FamilyID=06616212-0356-46A0-8DA2-EEBC53A68034&displaylang=en
(Ignore the mention of SQL Server 2000...you can install and use this database with later versions of SQL Server as well.) Once downloaded and installed, the necessary SQL command file will be placed in the installation folder you specified during installation (defaulting to "C:\SQL Server 2000 Sample Databases"). There will also be a "readme" HTML file that should help answer any questions you may have.
3) You must provide your server information in the connection string used by the business logic component, which you will find located within the MvcGallery.Business project found under Lib. To edit the connection string, load the MvcGallery solution into Visual Studio 2010 and open the settings (Settings.settings, found under Properties). There you will find the connection string available for editing. Currently, the connection string assumes the following server:
.\SQLEXPRESS
It also assumes Windows Authentication. Most readers should find this connection string sufficient. However, modify it as required to work with your local server. Failing to do so will result in data errors when running the sample application.
4) You will need to download and install both the Unity Application Block and Rhino Mocks to run this sample application:
Unity: http://unity.codeplex.com/releases/view/18855
Rhino Mocks: http://www.ayende.com/projects/rhino-mocks/downloads.aspx
Note you may also have to re-reference these assemblies. The Unity references are located in MvcGallery.Unity project, while thr Rhino Mocks references are in two test projects: HttpContextTests and SimpleCoordinatorTests.
5) To run the samples, first compile the entire solution. Then, select one of the many projects under Src in Solution Explorer and click the Debug button or press F5. The page for the sample will appear. You will find three tabs: the sample tab, the author tab, and an explanation tab. The sample tab will contain links and descriptive text designed to experiment with the given ASP.NET MVC task at hand. The author tab provides information about the book and training provided by the author. And the explanation tab provides additional insight regarding the particular aspects of ASP.NET MVC being demonstrated. Feel free to experiment!
Namespace MvcGallery.Business
Partial Public Class Customer
Public ReadOnly Property FullAddress() As String
Get
Return String.Format("{0}, {1} {2}", Address, PostalCode, City)
End Get
End Property
End Class
End Namespace
Namespace MvcGallery.Business
Public Class MissingProduct
Inherits Product
End Class
End Namespace
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{70D1EA77-F705-4A1B-831B-3CD9BBBFD8C0}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace></RootNamespace>
<AssemblyName>MvcGallery.Business</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<OptionExplicit>On</OptionExplicit>
<OptionCompare>Binary</OptionCompare>
<OptionStrict>Off</OptionStrict>
<OptionInfer>On</OptionInfer>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Data.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Diagnostics" />
<Import Include="System.Data" />
<Import Include="System.Linq" />
<Import Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Extensions\Customer.vb" />
<Compile Include="Extensions\MissingProduct.vb" />
<Compile Include="Northwind.designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Northwind.dbml</DependentUpon>
</Compile>
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="Northwind.dbml">
<Generator>MSLinqToSQLGenerator</Generator>
<LastGenOutput>Northwind.designer.vb</LastGenOutput>
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<Service Include="{3259AA49-8AA1-44D3-9025-A0B520596A8C}" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="Northwind.dbml.layout">
<DependentUpon>Northwind.dbml</DependentUpon>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
Imports System.Reflection
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
<Assembly: AssemblyTitle("MvcGallery.Business")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyConfiguration("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("MvcGallery.Business")>
<Assembly: AssemblyCopyright("Copyright © 2010")>
<Assembly: AssemblyTrademark("")>
<Assembly: AssemblyCulture("")>
' Setting ComVisible to false makes the types in this assembly not visible
' to COM components. If you need to access a type in this assembly from
' COM, set the ComVisible attribute to true on that type.
<Assembly: ComVisible(False)>
' The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("d51037c9-e315-4d39-a92f-ced0ee58ff62")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by Using the '*' as shown below:
' [assembly: AssemblyVersion("1.0.*")]
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.1
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")> _
Friend NotInheritable Partial Class Settings
Inherits System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As Settings = (CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New Settings()), Settings))
Public Shared ReadOnly Property [Default]() As Settings
Get
Return defaultInstance
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.Configuration.SpecialSettingAttribute(Global.System.Configuration.SpecialSetting.ConnectionString), Global.System.Configuration.DefaultSettingValueAttribute("Data Source=.\;Initial Catalog=Northwind;uid=sa;pwd=sa")> _
Public ReadOnly Property NorthwindConnectionString() As String
Get
Return (CStr(Me("NorthwindConnectionString")))
End Get
End Property
End Class
End Namespace
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="MvcGallery.Business.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="NorthwindConnectionString" Type="(Connection string)" Scope="Application">
<DesignTimeValue Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;ConnectionString&gt;Data Source=.\;Initial Catalog=Northwind;uid=sa;pwd=sa&lt;/ConnectionString&gt;
&lt;ProviderName&gt;System.Data.SqlClient&lt;/ProviderName&gt;
&lt;/SerializableConnectionString&gt;</DesignTimeValue>
<Value Profile="(Default)">Data Source=.\;Initial Catalog=Northwind;uid=sa;pwd=sa</Value>
</Setting>
</Settings>
</SettingsFile>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Database Name="Northwind" Class="NorthwindDataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
<Connection Mode="AppSettings" ConnectionString="Data Source=MY-LAPTOP;Initial Catalog=Northwind;Persist Security Info=True;User ID=sa" SettingsObjectName="MvcGallery.Business.Properties.Settings" SettingsPropertyName="NorthwindConnectionString" Provider="System.Data.SqlClient" />
<Table Name="dbo.Customers" Member="Customers">
<Type Name="Customer">
<Column Name="CustomerID" Type="System.String" DbType="NChar(5) NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
<Column Name="CompanyName" Type="System.String" DbType="NVarChar(40) NOT NULL" CanBeNull="false" />
<Column Name="ContactName" Type="System.String" DbType="NVarChar(30)" CanBeNull="true" />
<Column Name="ContactTitle" Type="System.String" DbType="NVarChar(30)" CanBeNull="true" />
<Column Name="Address" Type="System.String" DbType="NVarChar(60)" CanBeNull="true" />
<Column Name="City" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
<Column Name="Region" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
<Column Name="PostalCode" Type="System.String" DbType="NVarChar(10)" CanBeNull="true" />
<Column Name="Country" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
<Column Name="Phone" Type="System.String" DbType="NVarChar(24)" CanBeNull="true" />
<Column Name="Fax" Type="System.String" DbType="NVarChar(24)" CanBeNull="true" />
<Association Name="Customer_Order" Member="Orders" ThisKey="CustomerID" OtherKey="CustomerID" Type="Order" />
</Type>
</Table>
<Table Name="dbo.Employees" Member="Employees">
<Type Name="Employee">
<Column Name="EmployeeID" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
<Column Name="LastName" Type="System.String" DbType="NVarChar(20) NOT NULL" CanBeNull="false" />
<Column Name="FirstName" Type="System.String" DbType="NVarChar(10) NOT NULL" CanBeNull="false" />
<Column Name="Title" Type="System.String" DbType="NVarChar(30)" CanBeNull="true" />
<Column Name="TitleOfCourtesy" Type="System.String" DbType="NVarChar(25)" CanBeNull="true" />
<Column Name="BirthDate" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
<Column Name="HireDate" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
<Column Name="Address" Type="System.String" DbType="NVarChar(60)" CanBeNull="true" />
<Column Name="City" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
<Column Name="Region" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
<Column Name="PostalCode" Type="System.String" DbType="NVarChar(10)" CanBeNull="true" />
<Column Name="Country" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
<Column Name="HomePhone" Type="System.String" DbType="NVarChar(24)" CanBeNull="true" />
<Column Name="Extension" Type="System.String" DbType="NVarChar(4)" CanBeNull="true" />
<Column Name="Photo" Type="System.Data.Linq.Binary" DbType="Image" CanBeNull="true" UpdateCheck="Never" />
<Column Name="Notes" Type="System.String" DbType="NText" CanBeNull="true" UpdateCheck="Never" />
<Column Name="ReportsTo" Type="System.Int32" DbType="Int" CanBeNull="true" />
<Column Name="PhotoPath" Type="System.String" DbType="NVarChar(255)" CanBeNull="true" />
<Association Name="Employee_Employee" Member="Employees" ThisKey="EmployeeID" OtherKey="ReportsTo" Type="Employee" />
<Association Name="Employee_Order" Member="Orders" ThisKey="EmployeeID" OtherKey="EmployeeID" Type="Order" />
<Association Name="Employee_Employee" Member="Employee1" ThisKey="ReportsTo" OtherKey="EmployeeID" Type="Employee" IsForeignKey="true" />
</Type>
</Table>
<Table Name="dbo.Orders" Member="Orders">
<Type Name="Order">
<Column Name="OrderID" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
<Column Name="CustomerID" Type="System.String" DbType="NChar(5)" CanBeNull="true" />
<Column Name="EmployeeID" Type="System.Int32" DbType="Int" CanBeNull="true" />
<Column Name="OrderDate" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
<Column Name="RequiredDate" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
<Column Name="ShippedDate" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
<Column Name="ShipVia" Type="System.Int32" DbType="Int" CanBeNull="true" />
<Column Name="Freight" Type="System.Decimal" DbType="Money" CanBeNull="true" />
<Column Name="ShipName" Type="System.String" DbType="NVarChar(40)" CanBeNull="true" />
<Column Name="ShipAddress" Type="System.String" DbType="NVarChar(60)" CanBeNull="true" />
<Column Name="ShipCity" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
<Column Name="ShipRegion" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
<Column Name="ShipPostalCode" Type="System.String" DbType="NVarChar(10)" CanBeNull="true" />
<Column Name="ShipCountry" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
<Association Name="Order_Order_Detail" Member="Order_Details" ThisKey="OrderID" OtherKey="OrderID" Type="Order_Detail" />
<Association Name="Customer_Order" Member="Customer" ThisKey="CustomerID" OtherKey="CustomerID" Type="Customer" IsForeignKey="true" />
<Association Name="Employee_Order" Member="Employee" ThisKey="EmployeeID" OtherKey="EmployeeID" Type="Employee" IsForeignKey="true" />
</Type>
</Table>
<Table Name="dbo.[Order Details]" Member="Order_Details">
<Type Name="Order_Detail">
<Column Name="OrderID" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
<Column Name="ProductID" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
<Column Name="UnitPrice" Type="System.Decimal" DbType="Money NOT NULL" CanBeNull="false" />
<Column Name="Quantity" Type="System.Int16" DbType="SmallInt NOT NULL" CanBeNull="false" />
<Column Name="Discount" Type="System.Single" DbType="Real NOT NULL" CanBeNull="false" />
<Association Name="Order_Order_Detail" Member="Order" ThisKey="OrderID" OtherKey="OrderID" Type="Order" IsForeignKey="true" />
<Association Name="Product_Order_Detail" Member="Product" ThisKey="ProductID" OtherKey="ProductID" Type="Product" IsForeignKey="true" />
</Type>
</Table>
<Table Name="dbo.Products" Member="Products">
<Type Name="Product">
<Column Name="ProductID" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
<Column Name="ProductName" Type="System.String" DbType="NVarChar(40) NOT NULL" CanBeNull="false" />
<Column Name="SupplierID" Type="System.Int32" DbType="Int" CanBeNull="true" />
<Column Name="CategoryID" Type="System.Int32" DbType="Int" CanBeNull="true" />
<Column Name="QuantityPerUnit" Type="System.String" DbType="NVarChar(20)" CanBeNull="true" />
<Column Name="UnitPrice" Type="System.Decimal" DbType="Money" CanBeNull="true" />
<Column Name="UnitsInStock" Type="System.Int16" DbType="SmallInt" CanBeNull="true" />
<Column Name="UnitsOnOrder" Type="System.Int16" DbType="SmallInt" CanBeNull="true" />
<Column Name="ReorderLevel" Type="System.Int16" DbType="SmallInt" CanBeNull="true" />
<Column Name="Discontinued" Type="System.Boolean" DbType="Bit NOT NULL" CanBeNull="false" />
<Association Name="Product_Order_Detail" Member="Order_Details" ThisKey="ProductID" OtherKey="ProductID" Type="Order_Detail" />
</Type>
</Table>
<Function Name="dbo.CustOrderHist" Method="CustOrderHist">
<Parameter Name="CustomerID" Parameter="customerID" Type="System.String" DbType="NChar(5)" />
<ElementType Name="CustOrderHistResult">
<Column Name="ProductName" Type="System.String" DbType="NVarChar(40) NOT NULL" CanBeNull="false" />
<Column Name="Total" Type="System.Int32" DbType="Int" CanBeNull="true" />
</ElementType>
</Function>
</Database>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<ordesignerObjectsDiagram dslVersion="1.0.0.0" absoluteBounds="0, 0, 13.5, 8.5" name="Northwind">
<DataContextMoniker Name="/NorthwindDataContext" />
<nestedChildShapes>
<classShape Id="53743a20-5d7f-4db0-914b-9d7ecb1519ad" absoluteBounds="0.5, 1.125, 2, 2.9247054036458331">