Database Reference
In-Depth Information
The output of Listing 2-19 looks like the following:
--- All Businesses ---
Corner Dry Cleaning (#100X1)
Shop and Save (#200C)
BuyNow.com (#300AB)
--- Retail Businesses ---
Shop and Save (#200C)
101 Main
Anytown, TX 76106
---- eCommerce Businesses ---
BuyNow.com (#300AB)
Online address is: www.buynow.com
Table per type is one of three inheritance models supported by Entity Framework. The other two are Table per
Hierarchy (discussed in this chapter) and Table per Concrete Type (see Chapter 15).
Table per type inheritance provides a lot of database flexibility because we can easily add tables as new derived
types find their way into our model as an application develops. However, each derived type involves additional joins
that can reduce performance. In real-world applications, we have seen significant performance problems with TPT
when many derived types are modeled.
Table per hierarchy, as you will see in Recipe 2-10, stores the entire hierarchy in a single table. This eliminates
the joins of TPT and thereby provides better performance, but at the cost of some flexibility.
Table per concrete type is supported by the Entity Framework runtime, but not by the designer. Table per
Concrete Type has some important applications, as we will see in Chapter 15.
2-9. Using Conditions to Filter an ObjectSet
Problem
You want to create a permanent filter on an entity type so that it maps to a subset of the rows in a table.
Solution
Let's say that you have a table holding account information, as shown in the database diagram in Figure 2-18 .
The table has a DeletedOn nullable column that holds the date and time the account was deleted. If the account
is still active, the DeletedOn column is null. We want our Account entity to represent only active accounts; that is,
an account without a DeletedOn value.
 
 
Search WWH ::




Custom Search