我有一个MyList基于MyContentTypeSharepoint 中 ContentType 的列表。
现在我尝试使用 SPMetal 生成 LINQ 类,但 ContentType 的类基本上创建了两次。
SPMetal 的 XML 配置
<?xml version="1.0" encoding="utf-8"?>
<Web AccessModifier="Internal" xmlns="http://schemas.microsoft.com/SharePoint/2009/spmetal">
   <List Name="MyList">
       <ContentType Name="MyContentType"></ContentType>
   </List>
  <ExcludeOtherLists/>
  <ExcludeOtherContentTypes/>
</Web>
部分输出cs文件
[Microsoft.SharePoint.Linq.ListAttribute(Name="MyList")]
public Microsoft.SharePoint.Linq.EntityList<MyContentTypeMyContentType> MyList {
    get {
        return this.GetList<MyContentTypeMyContentType>("MyList");
    }
}
[...]
[Microsoft.SharePoint.Linq.ContentTypeAttribute(Name="MyContentType", Id="0x01003D132021D84A48E9A16011B7648CBD98")]
[Microsoft.SharePoint.Linq.DerivedEntityClassAttribute(Type=typeof(MyContentTypeMyContentType))]
internal partial class MyContentType : Element {
    [...]
}
[...]
[Microsoft.SharePoint.Linq.ContentTypeAttribute(Name="MyContentType", Id="0x01003D132021D84A48E9A16011B7648CBD98", List="MyList")]
internal partial class MyContentTypeMyContentType : MyContentType {
    public MyContentTypeMyContentType() {
        this.OnCreated();
    }
}
如您所见,它生成一个MyContentTypeMyContentType派生自MyContentType. 但为什么?没用的。我怎样才能避免这种行为?
如果MyList只是一个 EntityListMyContentType而不是MyContentTypeMyContentType.
附言
如果我在 XML 配置中为 ContentType 添加一个类名,如下所示:
<ContentType Name="MyContentType" class="MyContentType"></ContentType>
它仍然会生成第二个类并将其命名,MyContentType0这也是错误的。