lab introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · web viewthe test...

27
Code First Development with the ADO.Net Entity Framework in EF Feature CTP4 Hands-on Lab Manual

Upload: truongduong

Post on 20-Mar-2018

218 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity Framework inEF Feature CTP4

Hands-on LabManual

Page 2: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Information in this document, including URL and other Internet Web site references, is subject to change without notice. Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation.

The names of manufacturers, products, or URLs are provided for informational purposes only and Microsoft makes no representations and warranties, either expressed, implied, or statutory, regarding these manufacturers or the use of the products with any Microsoft technologies. The inclusion of a manufacturer or product does not imply endorsement of Microsoft of the manufacturer or product. Links are provided to third party sites. Such sites are not under the control of Microsoft and Microsoft is not responsible for the contents of any linked site or any link contained in a linked site, or any changes or updates to such sites. Microsoft is not responsible for webcasting or any other form of transmission received from any linked site. Microsoft is providing these links to you only as a convenience, and the inclusion of any link does not imply endorsement of Microsoft of the site or the products contained therein.

Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.

Copyright © 2007 Microsoft Corporation. All rights reserved.

Microsoft are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

The names of actual companies and products mentioned herein may be the trademarks of their respective owners.

Version 1.2

Page 3: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage of

Table of ContentsLab Introduction...................................................................................................................5

Objectives.........................................................................................................................5Prerequisites.....................................................................................................................5Lab Scenarios....................................................................................................................5Virtual PC Configuration and Setup...................................................................................6Copy/Paste of Code...........................................................................................................6

Exercise 1: Basic Data Access..............................................................................................7Exercise 2: Evolving the Domain Model.............................................................................14Exercise 3: Testing.............................................................................................................17Additional Resources..........................................................................................................22Copyright...........................................................................................................................23

Page 4: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage 4 of 23

Lab IntroductionEach Exercise in this lab is designed to be completed independently if you do not have time to complete all Exercises in one sitting.

Objectives After completing these self-paced labs, you will be able to:

Perform basic data access using the Code First development pattern with the Productivity Improvements for the ADO.Net Entity Framework (EF).

Keep your database schema in sync as your domain model evolves.

Test your application components using a separate test database with well-known seed data.

Prerequisites Experience with Visual Studio

Experience with writing LINQ queries

General experience with MVC is helpful but not required

Lab Scenarios This series of exercises is designed to show you how to get started using the Code First development pattern with the ADO.Net Entity Framework. Exercises can be completed as a sequence or can be completed independently.

Suggested Time for Completion: 30 minutes

Page 5: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage 5 of 23

Virtual PC Configuration and SetupThe Virtual PC machine name is EFCodeFirstLab.

The accounts and passwords used in the following exercises are shown in the following table:

Account Name Account Password Account Usage

DataDev passw0rd Login account for EFProdLab computer

Copy/Paste of CodeYou will have the option to copy/paste code snippets from this document to complete this lab.  In order to do this, you need to open a copy of this lab manual inside the Virtual Machine.  This specific lab can be found here: C:\HOLs\ EF Productivity Improvements\.

Page 6: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage 6 of 23

Exercise 1: Basic Data AccessIn this exercise, you will create a simple domain model for Blogs and Posts using CLR classes. You will then use these objects for data access in an MVC application using the Code First development pattern.

Tasks Detailed StepsCreate an Empty MVC Application

1. Start Visual StudioFrom the Windows task bar, select Start | All Programs | Microsoft Visual Studio 2010 | Microsoft Visual Studio 2010 menu item

2. When Microsoft Visual Studio 2010 opens, create a new Empty MVC2 Application ProjectFrom the File menu, select New | Project…

3. In the New Project dialog, select Visual C# | Web| ASP.NET MVC 2 Empty Web ApplicationFill in the names and location for the project:

Name BloggingLocation C:\HOLs\EF Productivity

Improvements\Exercise1\Solution Name Blogging

Page 7: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage 7 of 23

Tasks Detailed Steps4. Click OK to create the project

Build the Domain Model

In this step you will build a domain model using POCO (Plain Old CLR Object) classes, these classes have no dependency on the ADO.Net Entity Framework.

5. From the Solution Explorer, right-click on the Models folder and select Add | Class …This opens the Add New Item dialog

6. In the Add New Item dialog, give the class the name “Blog.cs”Click Add to add the class to your project

7. Implement the Blog class as follows:Note: We are annotating the primary key property with the [ScaffoldColumn(false)] to let MVC know that the user does not need to supply this valueusing System.Collections.Generic;using System.ComponentModel.DataAnnotations;

namespace Blogging.Models{ public class Blog { [ScaffoldColumn(false)] public int BlogId { get; set; } public string Name { get; set; } public string Owner { get; set; }

public virtual ICollection<Post> Posts { get; set; } }}

8. Repeat steps 5 & 6 to add another classed called “Post.cs”

9. Implement the Post class as follows:using System.ComponentModel.DataAnnotations;

namespace Blogging.Models{ public class Post { [ScaffoldColumn(false)] public int PostId { get; set; } public string Title { get; set; } public string Content { get; set; }

public virtual Blog Blog { get; set; } }}

Page 8: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage 8 of 23

Tasks Detailed StepsReference the EF Feature CTP4 Assembly

The Productivity Improvement features are currently in preview form and reside in a separate assembly from the core ADO.Net Entity Framework components. In this step you will add a reference to the assembly that contains these preview components.

10. From the Solution Explorer, right-click on the References folder and select Add Reference…This opens the Add Reference dialog

11. Select the .NET tab

12. Select Microsoft.Data.Entity.Ctp from the listNote: you will have to wait for a few seconds as the list is populated

13. Click OK to add the reference

Build a Derived DbContext

In this step you will create a context that derives from DbContext and exposes a DbSet<TEntity> for each type in the domain model. DbContext will automatically discover the model at runtime based on the DbSet properties. After discovering the model DbContext will then locate a database to use and create the schema to support the model, this is known as Code First development.

You can change the database that the DbContext will connect to and alter the shape of the database schema that is generated but that is beyond the scope of this lab, see the Additional Resources section for more information on this functionality.

14. From the Solution Explorer, right-click on the Models folder and select Add | Class …This opens the Add New Item dialog

15. In the Add New Item dialog, give the class the name “BloggingContext.cs”Click Add to add the class to your project

16. Implement the BloggingContext class as follows:using System.Data.Entity;

namespace Blogging.Models{ public class BloggingContext : DbContext { public DbSet<Blog> Blogs { get; set; } public DbSet<Post> Posts { get; set; } }}

Create a Blog Controller

In this step you will create an MVC controller that uses the domain model and derived context to query and persist data. This step will introduce you to the simplified API surface of DbContext and DbSet<TEntity>.

Page 9: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage 9 of 23

Tasks Detailed Steps17. From the Solution Explorer, right-click the Controllers folder and select Add |

Controller …This opens the Add Controller dialog

18. In the Add Controller dialog, give the controller the name “BlogController”

19. Check the “Add actions methods…” check-box

20. Click Add to add the controller to your project

21. Implement the BlogController as follows:Note: The return type of the Get methods is changed from ActionResult to ViewResult to help with testing in Exercise 3.using System.Linq;using System.Web.Mvc;using Blogging.Models;

namespace Blogging.Controllers{ public class BlogController : Controller { private BloggingContext context = new BloggingContext();

// // GET: /Blog/

public ViewResult Index() { // Use a LINQ query against a DbSet<Blog> // to select all blogs ordered by Name var blogs = from b in context.Blogs orderby b.Name select b;

return View(blogs.ToList()); }

// // GET: /Blog/Details/5

Page 10: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage 10 of 23

Tasks Detailed Steps public ViewResult Details(int id) { // Load the existing blog from the database return View(context.Blogs.Find(id)); }

// // GET: /Blog/Create

public ViewResult Create() { return View(new Blog()); }

// // POST: /Blog/Create

[HttpPost] public ActionResult Create(Blog b) { // Add the newly created blog context.Blogs.Add(b);

// Persist changes to the database context.SaveChanges();

return RedirectToAction("Index"); }

// // GET: /Blog/Edit/5

public ViewResult Edit(int id) { // Load the existing blog from the database return View(context.Blogs.Find(id)); }

// // POST: /Blog/Edit/5

[HttpPost] public ActionResult Edit(int id, FormCollection collection) { // Load the existing blog from the database var b = context.Blogs.Find(id);

// Apply the new values from the form UpdateModel(b);

// Persist changes to the database context.SaveChanges();

return RedirectToAction("Index"); }

// // GET: /Blog/Delete/5

Page 11: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage 11 of 23

Tasks Detailed Steps public ViewResult Delete(int id) { // Load the existing blog from the database return View(context.Blogs.Find(id)); }

// // POST: /Blog/Delete/5

[HttpPost] public ActionResult Delete(int id, FormCollection collection) { // Load the existing blog from the database var b = context.Blogs.Find(id);

// Delete the blog context.Blogs.Remove(b);

// Persist changes to the database context.SaveChanges();

return RedirectToAction("Index"); }

protected override void Dispose(bool disposing) { // Make sure the context gets disposed if (disposing) { context.Dispose(); }

base.Dispose(disposing); } }}

Make Blog the Default Controller

In this step you will set the Blog controller as the default controller so that a list of blogs is displayed when the MVC application is run.

22. From the Solution Explorer, open (double-click) on the Global.asax file

23. Replace the default controller with the Blog controller (highlighted below):public static void RegisterRoutes(RouteCollection routes){ routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Blog", action = "Index", id = UrlParameter.Optional } // Parameter defaults );

}

Page 12: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage 12 of 23

Tasks Detailed StepsAdd Views for the Blog Controller

Views provide a graphical user interface over the controller. Views are not directly related to data access so in this step you will add some pre-built views to your project.

24. From the Solution Explorer, right-click on the Views folder and select Add | New Folder

25. Name the folder “Blog”

26. Right-click on the newly created Blog folder and select Add Existing Item…This opens the Add Existing Item dialog

27. Navigate to “C:\HOLs\EF Productivity Improvements\Blog Views”

28. Select all the items in this folder (ctrl + A)

29. Click Add to add the views to your project.

Run the Application

30. Press F5 to run the Blog Application

31. Use the web interface to create some sample data

Page 13: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage 13 of 23

Exercise 2: Evolving the Domain ModelIn this exercise you will modify your domain model and then use database initializers to allow the database schema to be updated to reflect the changes to your domain model.Tasks Detailed StepsOpen the Project File

If you are continuing from Exercise 1 then you can skip to step 4.

1. Start Visual Studio.From the Windows task bar, select Start | All Programs | Microsoft Visual Studio 2010 | Microsoft Visual Studio 2010 menu item

2. Open the projectFrom the File menu, select File | Open | Project/Solution menu item.

3. From the Open Project dialog, open the solution file at C:\HOLs\EF Productivity Improvements \Exercise2\Blogging\Blogging.sln

4. Press F5 to run the applicationNote: This is important because the rest of this exercise depends on the database from Exercise 1 being created.

Page 14: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage 14 of 23

Tasks Detailed StepsChange the Model

In this step you will make some changes to your domain model. You will use data annotations to mark the Name property of Blog as required with a maximum length of 50 characters. By default DbContext will not alter the database schema and you will receive an exception because the domain model is no longer compatible with the database.

5. From the Solution Explorer, open (double-click) on the Models\Blog.cs file

6. Add the [Required] and [MaxLength(50)] data annotations to the Name property:public class Blog{ [ScaffoldColumn(false)] public int BlogId { get; set; }

[Required] [MaxLength(50)] public string Name { get; set; } public string Owner { get; set; }

public ICollection<Post> Posts { get; set; }}

7. Press F5 to run the application

8. You will receive the following exception:

Page 15: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage 15 of 23

Tasks Detailed StepsSet a Database Initializer

In this step you will set a database initializer for your derive context that will drop and recreate the database whenever the domain model changes.

9. From the Solution Explorer, open (double-click) on the Global.asax file

10. Add using statements for “System.Data.Entity.Infrastructure” and “Blogging.Models”using System.Data.Entity.Infrastructure;using Blogging.Models;

11. In the Application_Start method, set the initializer for the BloggingContext to recreate the database when the model changes:protected void Application_Start(){ AreaRegistration.RegisterAllAreas();

RegisterRoutes(RouteTable.Routes);

Database.SetInitializer<BloggingContext>( new RecreateDatabaseIfModelChanges<BloggingContext>());}

12. Press F5 to run the application

Page 16: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage 16 of 23

Exercise 3: TestingIn this exercise you will write a test for your MVC controller. The test will run against a SQL Compact database and the database will be recreated with a well-known set of test data before each run.

DbContext and DbSet also support abstracting the data access layer using interfaces so that in-memory fakes can be used to achieve true unit testing. This is beyond the scope of this lab, see additional resources for information on this topic.

Tasks Detailed StepsOpen the Project File

If you are continuing from Exercise 1 then you can skip to step 4.

1. Start Visual Studio.From the Windows task bar, select Start | All Programs | Microsoft Visual Studio 2010 | Microsoft Visual Studio 2010 menu item

2. Open the projectFrom the File menu, select File | Open | Project/Solution menu item.

3. From the Open Project dialog, open the solution file at C:\HOLs\EF Productivity Improvements \Exercise3\Blogging\Blogging.sln

Page 17: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage 17 of 23

Tasks Detailed StepsAdd a Test Project

In this step you will add a new test project to your solution.

4. From the Test menu, select New Test…

5. Select Basic Unit Test and name the test ‘BlogControllerTests’

6. Click OK to create the test

7. Enter ‘BloggingTests’ as the name of the test project

8. Click Create to create the test project

Page 18: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage 18 of 23

Tasks Detailed StepsReference the EF Feature CTP4 Assembly

The Productivity Improvement features are currently in preview form and currently reside in a separate assembly to the core ADO.Net Entity Framework components. In this step you will add a reference to the assembly that contains these preview components.

9. From the Solution Explorer, right-click on the BloggingTests project and select Add Reference…This opens the Add Reference dialog

10. Select the .NET tab

11. Select Microsoft.Data.Entity.Ctp from the listNote: you will have to wait for a few seconds as the list is populated

12. Click OK to add the reference

Reference the MVC Assembly

The tests you write are going to make use of types from the MVC framework. In this step you will add a reference to the MVC assembly.

13. Repeat steps 9 through 12 for System.Web.MVC

Reference Your MVC Project

The test you write is going to test the Blog controller from the MVC project so you need to add a reference to the MVC project.

14. From the Solution Explorer, right-click on the BloggingTests project and select Add Reference…This opens the Add Reference dialog

15. Select the Projects tab

16. Select Blogging from the list

17. Select OK to add the reference

Page 19: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage 19 of 23

Tasks Detailed StepsSwap Test Project to Run Against SQL Compact

In this step you will use the default connection factory to specify that all contexts used in the test project should use SQL Compact for their database.

18. In the “BlogControllerTests.cs” file that was created and opened, add the following using statements:using System.Data.Entity;using System.Data.Entity.Infrastructure;using Blogging.Controllers;using Blogging.Models;

19. Add an initialize method to swap DbContext to use SQL Compact by default:[TestClass]public class BlogControllerTests{ [ClassInitialize] public static void Initialize(TestContext c) { Database.DefaultConnectionFactory = new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0"); }

...}

Recreate the Database With Known Seed Data Before Each Run

In this step you will use a custom database initializer to ensure the database for the blogging context is recreated before each test run and contains a well-known set of seed data.

20. From the Solution Explorer, right-click on the BloggingTests project and select Add | Class …This opens the Add New Item dialog

21. In the Add New Item dialog, give the class the name “BlogInitializer.cs”Click Add to add the class to your project

22. Implement the BlogInitializer class as follows:using System.Data.Entity.Infrastructure;using Blogging.Models;

namespace BloggingTests{ class BlogInitializer : AlwaysRecreateDatabase<BloggingContext> { protected override void Seed(BloggingContext context) { context.Blogs.Add(new Blog { Name = "Test Blog", Owner = "Tester" }); context.Blogs.Add(new Blog { Name = "Another Blog", Owner = "Tester" }); } }}

Page 20: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage 20 of 23

Tasks Detailed Steps

23. From the Solution Explorer, open (double-click) on the BlogControllerTests.cs file

24. In the Initialize method register the new initializer for BloggingContext:[ClassInitialize]public static void Initialize(TestContext c){ Database.DefaultConnectionFactory = new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0");

Database.SetInitializer<BloggingContext>(new BlogInitializer());}

Page 21: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage 21 of 23

Tasks Detailed StepsImplement a Test

In this step you will implement a test for the blog controller. The test will make use of the well-known seed data to ensure that the Index action correctly returns all blogs ordered alphabetically by name.

25. Implement the TestMethod1 method as follows:[TestMethod]public void TestMethod1(){ var controller = new BlogController(); var result = controller.Index();

// Ensure two blogs were returned Assert.IsInstanceOfType(result.ViewData.Model, typeof(IEnumerable<Blog>)); var model = (IEnumerable<Blog>)result.ViewData.Model; Assert.AreEqual(2, model.Count());

// Ensure alphabetical sorting was applied Assert.AreEqual("Another Blog", model.ElementAt(0).Name); Assert.AreEqual("Test Blog", model.ElementAt(1).Name);}

26. From the Test menu select Run | All Tests in SolutionThe test will run and the Test Results window will be displayed

Page 22: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage 22 of 23

Additional Resources EF Feature CTP4 Download

Overview of Productivity Improvements for EF

Walkthrough of Productivity Improvements for EF

Databases and the DbContext Code First Development Pattern

Testing With In-Memory Fakes

ADO.Net Entity Framework Pre-Release Forum

EF Design Blog

MSDN Data Platform Developer Center

Page 23: Lab Introductiondownload.microsoft.com/download/f/d/c/fdc102d1-b7a5-4237... · Web viewThe test will run against a SQL Compact database and the database will be recreated with a well-known

Code First Development with the ADO.Net Entity FrameworkMicrosoft Hands-on LabsPage 23 of 23

CopyrightInformation in this document, including URL and other Internet Web site references, is subject to change without notice and is provided for informational purposes only. The entire risk of the use or results from the use of this document remains with the user, and Microsoft Corporation makes no warranties, either express or implied. Unless otherwise noted, the companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted in examples herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation.

Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.

© 2009 Microsoft Corporation. All rights reserved.

Microsoft and Windows are trademarks of the Microsoft group of companies.

All other trademarks are property of their respective owners.