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>

示例

下面的示例演示了将关联 (CourseInstructor) 的插入和删除函数映射到基础数据库中的存储过程的 EndProperty 元素。 映射到的函数在存储模型中声明。

<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 规范
建模和映射(实体框架)