Chapter 15. Entity Framework and ASP.NET
This chapter covers
- Binding data with the EntityDataSource control
- Using Dynamic Data controls and Entity Framework
- Understanding the ObjectContext lifecycle
- Common scenarios related to integrating ASP.NET and Entity Framework
ASP.NET is the technology used in the .NET Framework to build web applications. In this chapter, we’ll analyze the ASP.NET and Entity Framework integration, so a basic knowledge of data-binding techniques in ASP.NET is required. You can find more information on this topic on MSDN, in the “ASP.NET Data-Bound Web Server Controls Overview” article at http://mng.bz/c3k4.
You can use Entity Framework’s features in two different ways: you can use ASP.NET RAD support to directly tie them together; or you can manually manage the ObjectContext lifecycle by writing more code. The first approach has the main advantage of not requiring code, whereas the latter gives you maximum control over what is performed under the hood. Which is the best approach for your application is up to you: typically, the former is indicated in small (or quick-and-dirty) applications, because you can be very productive, whereas the latter is for enterprise applications. We’ll start with the simpler approach and then look at how to directly manage the ObjectContext lifecycle in a typical ASP.NET application.