Reputation: 6771
I have a list MyList
based on ContentType MyContentType
in Sharepoint.
Now I try to generate the LINQ classes with SPMetal but the class for ContentType is created twice basically.
XML config for SPMetal
<?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>
Parts of output cs file
[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();
}
}
As you can see it generates a MyContentTypeMyContentType
class derived from MyContentType
. But why? Its useless. How can I avoid this behaviour?
It would be correct if MyList
would just be an EntityList of MyContentType
instead of MyContentTypeMyContentType
.
PS
If I add a class name in the XML config for the ContentType like this:
<ContentType Name="MyContentType" class="MyContentType"></ContentType>
It still generates a second class and names it MyContentType0
which is wrong as well.
Upvotes: 1
Views: 831