共用方式為


DefiningQuery Element (EntityContainer SSDL)

The DefiningQuery element in store schema definition language (SSDL) defines a query that maps to data-store views through client-side projection within the Entity Data Model (EDM). Such mappings are read-only. Without client-side projection, users map all store-view columns and provide a dummy update customization.

A narrow projection of system views is used to generate a default EDM. The defining query is read-only. Entity Data Model tools use mapping artifacts to start workflow. For more information, see How to: Add a Defining Query.

The following SSDL syntax shows the declaration of an EntitySet followed by the DefiningQuery element that contains a query used to retrieve the view.

<Schema> 
    <EntitySet Name="Tables" EntityType="Self.STable"> 
        <DefiningQuery> 
          SELECT  TABLE_CATALOG, 
                  'test' as TABLE_SCHEMA, 
                  TABLE_NAME 
          FROM    INFORMATION_SCHEMA.TABLES
        </DefiningQuery> 
    </EntitySet> 
</Schema>

The support for stored procedures in the ADO.NET Entity Framework can be used to enable read-write scenarios over arbitrary views that the user knows how to update. Either a store-view or an Entity SQL view can be used as the base table for retrieving data and for change processing by stored procedures.

See Also

Concepts

Entity Sets (EDM)
Entity Framework Features

Other Resources

Entity Data Model Tools