Chapter 20. Real World Apps: Connections, Transactions, Performance, and More

By now, you must be wondering how the Entity Framework addresses the everyday concerns of software developers who must build real-world applications. How do you control connections? Is there any connection pooling? Are database calls transactional? What about security? How’s the performance? This chapter will address these and many of the additional questions developers ask after learning the basics of the Entity Framework.

You’ll learn more about working with entity connections and the database connections that they create for you, and how to explicitly open and control those connections, even when interleaving read and write operations to the database. You’ll also learn how transactions work by default, as well as how to replace the default database transactions that Entity Framework uses with .NET’s TransactionScope. For the security-minded, I’ll show you where you should be taking extra cautions and where you might be able to worry a little less. You’ll find a slew of ways you can improve performance in Entity Framework, as well as the results of some performance comparisons I’ve done. Finally, you’ll get to take a look at how to use Entity Framework in a few multithreading scenarios.

Entity Framework and Connections

A benefit of using the Entity Framework is that it takes care of writing the code to set up a database connection. Given a connection string typically defined in the EntityConnection defined ...

Get Programming Entity Framework, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.