
CYAN YELLOW MAGENTA BLACK PANTONE 123 C BOOKS FOR PROFESSIONALS BY PROFESSIONALS® THE EXPERT’S VOICE® IN .NET Companion eBook Available Pro Entity Framework 4.0 Pro Entity Framework 4.0 Entity Framework Dear Reader, ADO.NET Entity Framework is an object/relational mapping framework enabling you to work with relational data in terms of strongly typed objects. Entity Framework eliminates the need for writing much of the data access code found in many of today's applications. This book shows how to use ADO.NET Entity Framework 4.0 along with Visual Pro Studio 2010 to design and develop applications. I walk you through the changes and enhancements in the 4.0 release. You’ll see how to use the new features to build applications using common development environments such as Windows and WCF Data Services. I begin with an introductory look at the Entity Framework and key features such as the Entity Data Model. You’ll learn the internals of the Entity Data Model, and how to leverage those internals to create flexible applications. Then you’ll learn to query the Entity Data Model using LINQ, through a feature referred to as Entity “LINQ to Entities”. The rest of the book goes into many of the great new features such as sup- port for model-first development and code-only building of conceptual mod- els. There is better relationship support for foreign keys, and new support for T4 templates. You’ll find information on enhanced features such as improved stored procedure support. Detailed examples are provided in each chapter to illustrate Framework 4.0 how to use each of these new and improved features. I am a database guy. I live and breathe databases, especially SQL Server. I’m excited by Entity Framework 4.0 and what it offers to developers. My goals with this book are to provide background into what the Entity Framework is, and to show how it can be beneficial to you and your applications. I hope you find the informa- Companion eBook tion valuable and have as much fun working with Entity Framework as I have. Scott Klein The future of data access in .NET programming See last page for details on $10 eBook version THE APRESS ROADMAP Introducing .NET 4.0 Pro Entity Framework with Entity Framework 4.0 Recipes Visual Studio 2010 SOURCE CODE ONLINE Beginning Pro LINQ: Expert SQL Server 2008 Language Integrated SQL Server 2008 www.apress.com for Developers Query in C# 2010 Development ISBN 978-1-59059-990-7 Klein Scott Klein 5 54 9 9 US $54.99 Shelve in: Databases / SQL Server User level: 9 781590 599907 Intermediate–Advanced this print for content only—size & color not accurate 7.5 x 9.25 spine = 0.78125" 280 page count Pro Entity Framework 4.0 Scott Klein CONTENTS Pro Entity Framework 4.0 Copyright © 2010 by Scott Klein All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-59059-990-7 ISBN-13 (electronic): 978-1-4302-0648-4 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Publisher and President: Paul Manning Lead Editor: Jonathan Gennick Technical Reviewer: Vidya Vrat Agarwal Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie, Duncan Parkes, Jeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Project Manager: Anita Castro Copy Editor: Tiffany Taylor and Mary Ann Fugate Compositor: Bob Cooper Indexer: BIM Indexing & Proofreading Services Artist: April Milne Cover Designer: Anna Ishchenko Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders- [email protected], or visit www.springeronline.com. For information on translations, please e-mail [email protected], or visit www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales—eBook Licensing web page at www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. ii ■ CONTENTS To my parents, Richard and Carolyn. iii ■ CONTENTS Contents at a Glance Contents at a Glance...........................................................................................................................iv Contents ...............................................................................................................................................v About the Authors...............................................................................................................................xi About the Technical Reviewers.........................................................................................................xii Acknowledgments ............................................................................................................................xiii ■ Chapter 1: Introducing the ADO.NET 4.0 Entity Framework...........................................................1 ■ Chapter 2: The Entity Data Model .................................................................................................13 ■ Chapter 3: The Entity Data Model Inside and Out.........................................................................35 ■ Chapter 4: Querying the EDM ........................................................................................................63 ■ Chapter 5: Working with Entities ..................................................................................................83 ■ Chapter 6: Stored Procedures and the EDM .................................................................................93 ■ Chapter 7: Relationships and Associations................................................................................109 ■ Chapter 8: T4 Code Generation ...................................................................................................127 ■ Chapter 9: Model-First Development..........................................................................................145 ■ Chapter 10: Code-Only Development..........................................................................................167 ■ Chapter 11: N-tier Development with WCF Data Services .........................................................187 ■ Chapter 12: Performance Tuning and Exception Handling........................................................209 ■ Chapter 13: Data Binding with the Entity Framework................................................................229 ■ Index ............................................................................................................................................253 iv ■ CONTENTS Contents Contents at a Glance...........................................................................................................................iii Contents ...............................................................................................................................................v About the Authors...............................................................................................................................xi About the Technical Reviewers.........................................................................................................xii Acknowledgments ............................................................................................................................xiii ■ Chapter 1: Introducing the ADO.NET 4.0 Entity Framework...........................................................1 Need for an Entity Framework.......................................................................................................... 2 This Has Been Tried Before .......................................................................................................... 4 So, What Is the Entity Framework? .............................................................................................. 5 Database vs. Model .......................................................................................................................... 5 Database-Driven........................................................................................................................... 6 Model-Driven ................................................................................................................................ 6 Working with Entities........................................................................................................................ 8 Entity Framework 4.0 Features......................................................................................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages281 Page
-
File Size-