开发者

SPMetal not generating classes with proper custom types. Defaulting for everything to 'Item'

I'm trying to generate classes using SPMetal to make use o开发者_如何转开发f SPLINQ. Generating the code is no problem, except the properties are not typed properly.

This is fraction of the code:

[Microsoft.SharePoint.Linq.ListAttribute(Name="Actual Purchase Orders")]
public Microsoft.SharePoint.Linq.EntityList<Item> ActualPurchaseOrders {
    get {
        return this.GetList<Item>("Actual Purchase Orders");
    }
}

As you can see the return type is defined as Microsoft.SharePoint.Linq.EntityList<Item>. While I'd like it to be Microsoft.SharePoint.Linq.EntityList<ActualPurchaseOrder>. This is the same case for all lists and all properties for all list. The only properly typed properties are the sharepoint internal ones like Link, Document, HelpFilesDocument, etc.

I checked all list settings, like content types etc. No luck.

Is it just a bug in my 14.0.4763.1000 version?

Any help appreciated. Cheers.


If ActualPurchaseOrder is not a custom contenttype which you have defined, than you will have to override the spmetal tool with a parameters xml file. (http://msdn.microsoft.com/en-us/library/ee535056.aspx)

I think this blogpost will give you some good steps in the right direction: http://socialsp.com/2009/12/11/having-fun-with-the-new-linq-to-sharepoint-on-sharepoint-2010-sp2010/


public Microsoft.SharePoint.Linq.EntityList<*> ActualPurchaseOrders {

* -> should be the content type for the target list, not Item which is default content type.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜