共用方式為


EndProperty 項目 (MSL)

對應規格語言 (MSL) 中的 EndProperty 項目會定義概念模型關聯之一端或修改函式和基礎資料庫間的對應。 屬性資料行對應會指定在 ScalarProperty 子項目中。

EndProperty 項目用來定義概念模型關聯端的對應時,它是 AssociationSetMapping 項目的子項目。 當 EndProperty 項目用來定義概念模型關聯的修改函式之對應時,它是 InsertFunction 項目或 DeleteFunction 項目的子項目。

EndProperty 項目可以擁有下列子項目:

適用屬性

下表描述可套用至 EndProperty 項目的屬性。

屬性名稱 必要

Name

要對應的關聯端名稱。

範例

下列範例顯示 AssociationSetMapping 項目,其中概念模型中的 FK_Course_Department 關聯會對應至資料庫中的 Course 資料表。 關聯類型屬性和資料表資料行間的對應是在 EndProperty 子項目中指定。

<AssociationSetMapping Name="FK_Course_Department" 
                       TypeName="SchoolModel.FK_Course_Department" 
                       StoreEntitySet="Course">
  <EndProperty Name="Department">
    <ScalarProperty Name="DepartmentID" ColumnName="DepartmentID" />
  </EndProperty>
  <EndProperty Name="Course">
    <ScalarProperty Name="CourseID" ColumnName="CourseID" />
  </EndProperty>
</AssociationSetMapping>

範例

下列範例顯示的 EndProperty 項目會將關聯的插入和刪除函式 (CourseInstructor) 對應至基礎資料庫中的預存程序。 對應至的函式會在儲存體模型中宣告。

<AssociationSetMapping Name="CourseInstructor" 
                       TypeName="SchoolModel.CourseInstructor" 
                       StoreEntitySet="CourseInstructor">
  <EndProperty Name="Person">
    <ScalarProperty Name="PersonID" ColumnName="PersonID" />
  </EndProperty>
  <EndProperty Name="Course">
    <ScalarProperty Name="CourseID" ColumnName="CourseID" />
  </EndProperty>
  <ModificationFunctionMapping>
    <InsertFunction FunctionName="SchoolModel.Store.InsertCourseInstructor" >   
      <EndProperty Name="Course">
        <ScalarProperty Name="CourseID" ParameterName="courseId"/>
      </EndProperty>
      <EndProperty Name="Person">
        <ScalarProperty Name="PersonID" ParameterName="instructorId"/>
      </EndProperty>
    </InsertFunction>
    <DeleteFunction FunctionName="SchoolModel.Store.DeleteCourseInstructor">
      <EndProperty Name="Course">
        <ScalarProperty Name="CourseID" ParameterName="courseId"/>
      </EndProperty>
      <EndProperty Name="Person">
        <ScalarProperty Name="PersonID" ParameterName="instructorId"/>
      </EndProperty>
    </DeleteFunction>
  </ModificationFunctionMapping>
</AssociationSetMapping>

另請參閱

概念

Association 項目 (CSDL)
ModificationFunctionMapping 項目 (MSL)

其他資源

CSDL、SSDL 和 MSL 規格
模型及對應 (Entity Framework)