简体   繁体   English

SPMetal不生成具有适当自定义类型的类。 将所有内容默认为“项目”

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

I'm trying to generate classes using SPMetal to make use of SPLINQ. 我正在尝试使用SPMetal生成类来使用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> . 如您所见,返回类型定义为Microsoft.SharePoint.Linq.EntityList<Item> While I'd like it to be Microsoft.SharePoint.Linq.EntityList<ActualPurchaseOrder> . 虽然我希望它是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. 唯一正确输入的属性是Sharepoint,如Link,Document,HelpFilesDocument等。

I checked all list settings, like content types etc. No luck. 我检查了所有列表设置,如内容类型等。没有运气。

Is it just a bug in my 14.0.4763.1000 version? 这只是我的14.0.4763.1000版本中的一个错误吗?

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. 如果ActualPurchaseOrder不是您定义的自定义内容类型,则必须使用参数xml文件覆盖spmetal工具。 (http://msdn.microsoft.com/en-us/library/ee535056.aspx) (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/ 我认为这篇博文将为您提供正确方向的一些好步骤: http//socialsp.com/2009/12/11/having-fun-with-the-new-linq-to-sharepoint-on-sharepoint-2010 -sp2010 /

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

* - >应该是目标列表的内容类型,而不是Item是默认的内容类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM