Megosztás a következőn keresztül:


CommandText Element (SSDL)

The CommandText element in store schema definition language (SSDL) is a child of the Function element that allows you to define a SQL statement that is executed at the database. The CommandText element allows you to add functionality that is similar to a stored procedure in the database, but you define the CommandText element in the storage model.

The CommandText element cannot have child elements. The body of the CommandText element must be a valid SQL statement for the underlying database.

No attributes are applicable to the CommandText element.

Example

The following example shows a Function element with a child CommandText element. Expose the UpdateProductInOrder function as a method on the ObjectContext by importing it into the conceptual model. For more information, see How to: Define Custom Functions in the Storage Model and How to: Import a Stored Procedure.

<Function Name="UpdateProductInOrder" IsComposable="false">
  <CommandText>
    UPDATE Orders
    SET ProductId = @productId
    WHERE OrderId = @orderId;
  </CommandText>
  <Parameter Name="productId"
             Mode="In"
             Type="int"/>
  <Parameter Name="orderId"
             Mode="In"
             Type="int"/>
</Function>

See Also

Concepts

Entity Framework Overview
SSDL Specification
Function Element (SSDL)

Other Resources

CSDL, SSDL, and MSL Specifications
ADO.NET Entity Data Model Tools
How to: Add a Defining Query