Entity Framework 4 in Action
Stefano Mostarda, Marco De Sanctis, and Daniele Bochicchio
  • May 2011
  • ISBN 9781935182184
  • 576 pages
  • printed in black & white

Answers questions you didn't even know you had.

Noam Ben-Ami, Microsoft

Entity Framework 4 in Action is an example-rich tutorial for .NET developers with full coverage of EF 4 features. The book begins with a review of the core ideas behind the ORM model and shows through detailed examples and larger case studies how Entity Framework offers a smooth transition from a traditional ADO.NET approach.

Table of Contents show full




about this book

about the cover illustration

Part 1 Redefining your data-access strategy

1. Chapter 1 Data access reloaded: Entity Framework

1.1. Getting started with data access

1.2. Developing applications using database-like structures

1.3. Using classes to organize data

1.4. Delving deep into object/relational differences

1.5. Letting Entity Framework ease your life

1.6. How Entity Framework performs data access

1.7. Summary

2. Chapter 2 Getting started with Entity Framework

2.1. Introducing the OrderIT example

2.2. Designing the OrderIT model and database

2.3. Structuring the application

2.4. A sneak peek at the code

2.5. Summary

Part 2 Getting started with Entity Framework

3. Chapter 3 Querying the object model: the basics

3.1. One engine, many querying methods

3.2. The query engine entry point: Object Services

3.3. Summary

4. Chapter 4 Querying with LINQ to Entities

4.1. Filtering data

4.2. Projecting results

4.3. Grouping data

4.4. Sorting

4.5. Joining data

4.6. Querying with inheritance

4.7. Using functions

4.8. Executing handmade queries

4.9. Fetching

4.10. Summary

5. Chapter 5 Domain model mapping

5.1. The Entity Data Model

5.2. Creating consumable entities

5.3. Defining relationships in the model

5.4. Mapping inheritance

5.5. Extending the EDM with custom annotations

5.6. Summary

6. Chapter 6 Understanding the entity lifecycle

6.1. The entity lifecycle

6.2. Managing entity state

6.3. Managing change tracking with ObjectStateManager

6.4. Summary

7. Chapter 7 Persisting objects into the database

7.1. Persisting entities with SaveChanges

7.2. Persisting changed entities into the database

7.3. Persisting entities graphs

7.4. A few tricks about persistence

7.5. Summary

8. Chapter 8 Handling concurrency and transactions

8.1. Understanding the concurrency problem

8.2. Handling concurrency in Entity Framework

8.3. Managing transactions

8.4. Summary

Part 3 Mastering Entity Framework

9. Chapter 9 An alternative way of querying: Entity SQL

9.1. Query basics

9.2. Filtering data

9.3. Projecting results

9.4. Grouping data

9.5. Sorting data

9.6. Joining data

9.7. Querying for inheritance

9.8. Using query-builder methods

9.9. Working with the Entity Client data provider

9.10. Summary

10. Chapter 10 Working with stored procedures

10.1. Mapping stored procedures

10.2. Returning data with stored procedures

10.3. Embedding functions in the storage model

10.4. Updating data with stored procedures

10.5. Summary

11. Chapter 11 Working with functions and views

11.1. Views in the storage model: defining queries

11.2. User-defined functions and scalar-valued functions

11.3. Summary

12. Chapter 12 Exploring EDM metadata

12.1. Metadata basics

12.2. Retrieving metadata

12.3. Building a metadata explorer

12.4. Writing generic code with metadata

12.5. Summary

13. Chapter 13 Customizing code and the designer

13.1. How Visual Studio generates classes

13.2. Customizing class generation

13.3. How Visual Studio generates database DDL

13.4. Customizing DDL generation

13.5. Creating designer extensions

13.6. Summary

Part 4 Applied Entity Framework

14. Chapter 14 Designing the application around Entity Framework

14.1. The application design process

14.2. A typical three-layer architecture

14.3. Principles of domain-driven design

14.4. Retrieving references to a domain’s entities

14.5. Summary

15. Chapter 15 Entity Framework and ASP.NET

15.1. EntityDataSource, a new approach to data binding

15.2. Using Dynamic Data controls with Entity Framework

15.3. The ObjectContext lifecycle in ASP.NET

15.4. Common scenarios involving ASP.NET and Entity Framework

15.5. Summary

16. Chapter 16 Entity Framework and n-tier development

16.1. n-Tier problems and solutions

16.2. Developing a service using entities as contracts

16.3. Developing a service using DTOs

16.4. Developing a service using STEs

16.5. Summary

17. Chapter 17 Entity Framework and Windows applications

17.1. An example application

17.2. Designing model classes for binding

17.3. Binding in Windows Forms applications

17.4. Binding in WPF applications

17.5. Summary

18. Chapter 18 Testing Entity Framework

18.1. Unit tests at a glance

18.2. Writing a test suite in Visual Studio 2010

18.3. Isolating dependencies

18.4. Unit-testing the data access layer

18.5. Testing the persistence and retrieval of an entity

18.6. Summary

19. Chapter 19 Keeping an eye on performance

19.1. Testing configuration and environment

19.2. Database-writing comparison

19.3. Query comparisons in the default environment

19.4. Optimizing performance

19.5. Summary

Appendix A: : Understanding LINQ

Appendix B: : Entity Framework tips and tricks


© 2014 Manning Publications Co.

About the Technology

Entity Framework builds on the ADO.NET persistence model and the language features of LINQ to create a powerful persistence mechanism that bridges the gap between relational databases and object-oriented languages.

About the book

Entity Framework 4 in Action is an example-rich tutorial that helps .NET developers learn and master the subject. It begins by explaining object/relational mapping and then shows how you can easily transition to EF from ADO.NET. Through numerous focused examples and two larger case studies, the book unfolds the EF story in a clear, easy-to-follow style. Infrastructure and inner workings of EF are discussed when you need them to understand a particular feature.

What's inside

  • Full coverage of EF 4 features
  • Layer separation, Data Layer, and Domain Model
  • Best practices

About the reader

This book is written for .NET developers. Knowledge of ADO.NET is helpful but not required.

About the authors

Stefano Mostarda, Marco De Sanctis, and Daniele Bochicchio are all ASP.NET MVPs and core members of ASPItalia.com, Italy's largest .NET community. Collectively, they have over 25 years of .NET development experience.

eBook $39.99 pdf + ePub + kindle

FREE domestic shipping on three or more pBooks

Finally, real insight into the Framework.

Christian Siegers, Capgemini

.NET database development at the next level.

Berndt Hamboeck, pmOne

Easy to read, comprehend, and apply.

David Barkol, Neudesic

All you need to conquer the ORM beast.

Jonas Bandi, TechTalk