Database Reference
In-Depth Information
Figure 2-18. Account table with DeletedOn DateTime column
To model this table so that only active accounts are used to populate the Account entity type, do the following:
1.
Add a new model to your project by right-clicking your project and selecting Add New
Item. Choose ADO.NET Entity Data Model from the Visual C# Data templates.
2.
Select Generate from database. Click Next.
3.
Use the wizard to select an existing connection to your database, or create a new
connection.
4.
From the Choose Your Database Object dialog box, select the Account table. Leave the
Pluralize and Foreign Key options checked. Click Finish.
5.
Click the Account entity to view the Mapping Details window. If the Mapping Details
window is not visible, show it by selecting View Other Windows Entity Data Model
Mapping Details. Click Add a Condition, and select the DeletedOn column. In the
Operator column, select Is, and in the Value/Property column, select Null. This creates a
mapping condition when the DeletedOn column is Is Null (see Figure 2-19 ).
Search WWH ::




Custom Search