所需积分/C币:9 2015-09-13 10:09:18 7.01MB PDF
收藏 收藏

Code-First Development with Entity Framework Copyright o 2015 Packt Publishi ing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews rt has been made in the preparation of this book to ensure the accuracy of the information presented However the information contained in this book is sold without warranty either express or implied. Neither the author nor packt Publishing and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals However, Packt Publishing cannot guarantee the accuracy of this information First published: March 2015 Production reference: 1110315 Published by Packt Publishing ltd Livery place 35 Livery street Birmingham b3 2PB UK ISBN978-1-78439627-5 www.packtpub.com Credits Author Project Coordinator Sergey Barsky Rashi Khivansara Reviewers Proofreaders Erik Ejlskov Jensen Maria gould Andriy Svyryd Elinor Perry-Smith Commissioning editor Indexer Sarah crofton Mariamman Chettiyar Acquisition Editor Production coordinator Usha lye Content development editor Cover work Natasha d'souza Manu jose Technical editor Narsimha pai Copy Edit Deepa cambial About the author Sergey barskiy is an architect with tyler Technologies. He lives in Atlanta, Ga He has been developing software for almost 20 years. Sergey is a Microsoft MVP He holds these microsoft certifications: MCPD, MctS, MCSD for NET, MCad for NET, MCDBA, and MCP Ile has been working with Microsoft Technologies for over 15 years. He is a frequent speaker at various regional and national conferences such as VS Live, DevLink, CodeStock, and Atlanta Code Camp, as well as local user groups. He is one of the organizers of Atlanta Code Camp. He authored articles for Code magazine gey barsky has been using entity Framework since it was first released to the public. He has deployed a number of projects to production that used Entity Framework over the years. He has used the Code-First approach on a few different projects as well. Sergey has produced an online video training course for this technology. He has spoken on Entity Framework Code-First at a number of national and regional conferences and events Youcantweettohimat@serGeybarskiyore-mailhimatsergeyobarskiy.com I would like to thank my family for putting up with my busy schedule during the time i was working on this book. i want to also thank packt Publishing for giving me the courage and opportunity to work on this project About the reviewers Erik eilskov Jensen is a Danish. net developer who specializes in. neT data development. He is a Microsoft MVP for SQL Server and shares tips and code via hisblogathttp://erikej.blogspot.comandTwitterataeriKej.Heisaproject manager for a number of SQL Server Compact and SQLite tools on the Codeplex site, and he is the creator of the popular free Visual Studio add-in SQL Server Compact/ SQLite Toolbox. He also contributes to a number of open source projects, including Entity Framework Andriy svyryd was born in Ukraine, and then he moved to Mexico, where he graduated from Universidad Nacional autonoma de mexico(UNAM). His first job was at microsoft, where he worked on several projects related to data modeling He was a developer on the entity framework team for 4 vears Www.Packtpub.com Support files, e Books, discount offers, and more Forsupportfilesanddownloadsrelatedtoyourbookpleasevisitwww.PacktPub.com Did you know that Packt offers e Book versions of every book published, with PDF andepubfilesavailableYoucanupgradetotheebookversionatwww.packtpub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service(@packtpub com for more details Atwww.packtPub.comyoucanalsoreadacollectionoffreetechnicalarticles sign up for a range of free newsletters and receive exclusive discounts and offers on packt books and ebooks ⊙ PACKTLIB https://www2.packtpub.com/books/subscription/packtlib book library. Here, you can search, access, and read Packt s entire library of books i Do you need instant solutions to your IT questions? PacktLib is Packt's online digital Why subscribe? Fully searchable across every book published by Packt Copy and paste, print, and bookmark content On demand and accessible via a web browser Free access for packt account holders IfyouhaveanaccountwithPacktatwww.packtpub.comyoucanusethistoaccess PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access Table of contents Preface Chapter 1: Introducing Entity Framework What is ORM? a brief history of Entity Framework The capabilities of entity framework The entity Framework architecture Self-test questions Summary Chapter 2: Your First Entity Framework Application Creating a new project that uses Entity Framework 11345667892 Creating a new database based on NET classes Saving a new record to the database Querying data in a database 15 Updating a record 16 Deleting a row from the database 17 Introduction to schema changes Self-test questions Summary 23 Chapter 3: Defining the Database Structure 25 Creating table structures 26 lapping NET types to SQL types 26 Configuring primitive properties 27 Handling nullable properties 33 Defining relationships 35 The One-to-Many relationship 35 The Many-to-Many relationship 41 The One-to-One relationship 42 Table of contents Self-test questions 44 Summary 45 Chapter 4: Querying, Inserting, Updating, and Deleting Data 47 The basics of LINQ 47 Filtering data in queries 49 Sorting data in queries 51 Exploring LINQ functions 52 Element operations 52 Quantifiers 53 Working with related entities 54 Filtering based on related data 54 Lazy and eager loading 55 Inserting data into the database 57 Updating data in the database 60 Deleting data from the database 65 Working with in-memory data 67 Self-test questions 69 Summary 70 Chapter 5: Advanced Modeling and Querying Techniques 73 Advanced modeling techniques 74 Complex ty 74 Using an explicit table and column mappings Adding supporting columns 78 Enumerations 79 Using multiple tables for a single entity 80 Advanced querying techniques 83 Projections 83 Aggregations and grouping 88 Advanced query construction 89 Paging data with windowing functions 92 Using joins 93 Groupings and left outer joins 95 Set operations 101 Self-test questions 102 ummary 104 Table of Contents Chapter 6: Working with Views, Stored Procedures, the Asynchronous APl, and Concurrency 105 Working with views 106 Working with stored procedures 110 Create, update, and delete entities with stored procedures 112 The asynchronous aPl 115 Handling concurrency 119 Self-test questions 123 Summary 24 Chapter 7: Database Migrations and Additional Features 125 Enabling and running migrations 126 Using the migrations AP 130 Applying migrations 135 Applying migrations via a script 136 Applying migrations via migrate.exe 136 Applying migrations via an initializer 137 Adding migrations to an existing database 138 Additional Entity Framework features 139 Custom conventions 139 Geospatial data 140 Dependency injection and logging 140 Startup performance 141 Multiple contexts per database 141 Self-test questions 142 Summary 143 Appendix: Answers to Self-test Questions 145 Index 151

试读 127P EF最新教程
立即下载 低至0.43元/次 身份认证VIP会员低至7折
  • 分享精英

关注 私信
EF最新教程 9积分/C币 立即下载

试读结束, 可继续阅读

9积分/C币 立即下载 >