O'Reilly logo

Programming Entity Framework, 2nd Edition by Julia Lerman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required