ExcludeOtherContentTypes 元素 (SPMetal)

适用于: SharePoint 2016 |SharePoint Foundation 2013 |SharePoint Online |SharePoint Server 2013

指定仅针对 ContentType 元素显式表示的内容类型生成类。

<ExcludeOtherContentTypes />

元素和属性

下面各部分介绍了属性、子元素和父元素。

Attributes

无。

子元素

无。

父元素

元素 说明
Web
指定从 SPMetal 生成的 DataContext) 派生 (类 (公共或内部) 的名称和访问级别。

备注

Web 元素不能同时具有 ExcludeOtherContentTypes 元素和 IncludeHiddenContentTypes 元素。

示例

下面是正在使用的 ExcludeOtherContentTypes 元素的示例。 在此示例中,它确保仅为 联系人 内容类型生成类。

<?xml version="1.0" encoding="utf-8"?>
<Web AccessModifier="Internal" xmlns="http://schemas.microsoft.com/SharePoint/2009/spmetal">
  <ContentType Name="Contact" Class="Contact">
    <Column Name="ContId" Member="ContactId" />
    <Column Name="ContactName" Member="ContactName1" />
    <Column Name="Category" Member="Cat" Type="String"/>
  </ContentType>
  <ExcludeOtherContentTypes />
  <List Name="Team Members">
    <ContentType Name="Item" Class="TeamMember" />
  </List>
</Web>

另请参阅