共用方式為


Configure Data Source Wizard (EntityDataSource Control)

The Configure Data Source wizard of the EntityDataSource control in the ASP.NET framework is a two page wizard used to initialize the data source. On the first page of the wizard, you can select a named connection from the WebConfig file or add a connection string that identifies the database. The content of the second page of the wizard depends on whether you are using a Select statement configured by the options on the wizard or another command text of your own design.

Wizard Page One

The illustration below shows the first page of the wizard. The Named Connection AdvWksSalesEntities from the project Web.config file is selected in the drop-down list. The selection in DefaultContainerName drop-down list is also AdvWksSalesEntities. The connection string in an implementation of the Entity Data Model (EDM) is, by default, identified by the EntityContainer in the design schema. For more information about the EntityContainer type, see ADO.NET Entity Framework. The first page of the wizard looks like this:

EntityDataSource configuration wizard page 1

For more information about the properties of the EntityDataSource that are initialized by the first page of the wizard, see Configuring the EntityDataSource Control.

Wizard Page Two

The second page of the wizard has two possible views; one or the other is displayed depending on whether the Select property is assigned a value.

The Simple Select Wizard View

The simple Select wizard view is displayed when the Select property of the EntityDataSource control is unassigned or when the Select property is assigned a comma-separated list of recognized entity properties of the form: item.[Property1], item.[Property2], with or without the escaping brackets. The possible set of properties for the DefaultContainerName, EntitySetName, and EntityTypeFilter must all be recognized as valid values in the data model used by the application

From the simple Select wizard view, the user selects EntitySetName, optionally enters an EntityTypeFilter, and selects the properties to display in the data control. The EntityTypeFilter is only needed when using derived types in an inheritance hierarchy.

When the user checks Select All (Entity Value), full entities are returned instead of results that contain individual properties. Entity values are updatable, and also allow data bound controls to display and modify the key properties of related entities and complex type members.

The following illustration shows the simple Select view for page two of the wizard.

EntityDataSource configuration wizard page 2A

The Advanced Select Wizard View

The advanced Select wizard view, as shown below, is displayed when the Select property is set to any value other than the options displayed by the simple view.

EntityDataSource configuration wizard page 2B

The Enable Automatic Insert, Enable Automatic Update, and Enable Automatic Delete checkboxes each have two possible values. For the simple Select wizard page, if anything other than Select All is selected in the list of properties, these checkboxes are unchecked and disabled in the advanced Select wizard page. For the advanced Select wizard view, these checkboxes are unchecked and disabled as soon as anything is entered into the Select textbox, as shown by the custom select statement in the illustration.

Note

As in the Entity Framework, using Select creates a projection of the data. Projections are not updateable. Select cannot be set if Enable Automatic Delete, Enable Automatic Insert, or Enable Automatic Update is enabled.

See Also

Concepts

Data Projections (EntityDataSource)

Toolbox Item (EntityDataSource Control)

Design-Time Control (EntityDataSource Control)

Expression Editor (Entity Data Source Control)

Property Page (EntityDataSource Control)

Configuring the EntityDataSource Control

Change History

Date

History

Reason

July 2008

Added topic.

SP1 feature change.