Chapter 20. Using the Entity Framework in n-Tier Client-Side Applications

Many applications implement their user interface, business logic, and data access layer completely on the client side. This is typical in scenarios where the application is completely self-contained on the end-user’s machine or users are on a corporate intranet.

Even with these smaller applications, however, you should do your best to separate the UI from business logic and data access logic.

This is not a big challenge for the Entity Framework, because it is reasonable to work with a long-running ObjectContext and take advantage of the Entity Framework’s change tracking from the time the data is queried to the time that changes are persisted to the database.

The Entity Framework handles all of the interaction with the database and can be thought of as a data access layer. Through the use of partial classes or your own custom classes, a business layer can provide some of the logic that pertains directly to data, such as the validations I demonstrated earlier in the book. But the tasks of interacting with the data store and validating data are not responsibilities of the user interface. So in this chapter, we will focus on separating the logic of interacting with the user from that of interacting with objects and data.

This chapter will work through many of the important tasks of building a layered, client-side application. Although it will use a specific application as its focus, you will not be building the application ...

Get Programming Entity Framework 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.