Function 요소(SSDL)

EDM(엔터티 데이터 모델)에서 SSDL(저장소 스키마 정의 언어)로 된 Function 요소 정의에서는 데이터베이스에 저장 프로시저가 존재하도록 지정합니다. 중첩된 매개 변수 요소는 매개 변수 이름과 해당 데이터 형식을 지정합니다. 이러한 정의는 엔터티에 매핑할 수 있는 저장 프로시저와 그 속성을 식별합니다.

현재 릴리스의 Entity Framework에서 저장 프로시저를 나타내는 함수 선언의 IsComposable 특성은 false로 설정되어야 합니다. 이 설정은 프로시저에서 반환되는 결과를 다른 SQL 문의 FROM 절에 사용할 수 없음을 나타냅니다.

저장 프로시저에 대한 방법 항목은 방법: 저장 프로시저로 모델 정의(Entity Framework)를 참조하십시오.

다음 예제에서는 SUBSTRING 함수의 SSDL 메타데이터를 보여 줍니다.

<?xml version="1.0" encoding="utf-8"?>
<Schema Namespace="Northwind" Alias="Self" 
xmlns:edm="https://schemas.microsoft.com/ado/2006/04/edm/ssdl"
   xmlns="https://schemas.microsoft.com/ado/2006/04/edm/ssdl">

   <! Other declarations.-->
  <Function Name="SUBSTRING" ReturnType="varchar" BuiltIn="true">
    <Documentation> 
       <Summary>Function accepts a source string, the starting position
         and the length of the sub-string to be extracted</Summary> 
       <LongDescription>Long Description if needed. </LongDescription> 
    </Documentation>

    <Parameter Name="str" Mode="In" Type="varchar" />
    <Parameter Name="start" Mode="In" Type="int">
      <Documentation> 
        <Summary>The starting position of the substring</Summary> 
        <LongDescription>Long Description.</LongDescription> 
      </Documentation>
    </Parameter>

    <Parameter Name="length" Mode="In" Type="int" />
  </Function>

</Schema>

다음 SSDL 선언에서는 엔터티를 만들고 업데이트하며 삭제하는 데 쓰이는 세 개의 저장 프로시저, 즉 CreateVendor, UpdateVendor, DeleteVendor와 그에 포함되는 데이터를 지정합니다.

<Function Name="CreateVendor" IsComposable="false" Schema="dbo">    
    <Parameter Name="ID" Type="int" />    
    <Parameter Name="Name" Type="nvarchar" />    
    <Parameter Name="Description" Type="nvarchar(max)" />    
  </Function>

  <Function Name="UpdateVendor" IsComposable="false" Schema="dbo">
    <Parameter Name="ID" Type="int" />
    <Parameter Name="Name" Type="nvarchar" />
    <Parameter Name="Description" Type="nvarchar(max)" />
  </Function>

  <Function Name="DeleteVendor" IsComposable="false" Schema="dbo">
    <Parameter Name="ID" Type="int" />    
  </Function>
</Schema>

참고 항목

작업

방법: 저장 프로시저로 모델 정의(Entity Framework)

개념

저장 프로시저 지원(Entity Framework)