为什么 SPMetal 不生成发布计划列?

发布于 2024-10-09 15:07:19 字数 221 浏览 0 评论 0原文

2011 年快乐,专家们,,,

我有一个 sharepoint 2010 发布网站,我使用 SPMetal 来生成类。 问题是某些字段不会生成,例如:

PublishingStartDate 和 PublishingEndDate,即使我尝试使用 IncludeHiddenColumns 和 IncludeHiddenContentTypes 参数但没有成功。

有什么线索吗?

Happy 2011 experts,,,

I have a sharepoint 2010 publishing site that I use SPMetal to generate classes to.
The problem is some fields doesn't get generated like:

PublishingStartDate and PublishingEndDate even though I tried using IncludeHiddenColumns and IncludeHiddenContentTypes parameters with no success.

Any clue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我是有多爱你 2024-10-16 15:07:19

默认情况下,SPMetal 仅为 SharePoint Foundation 2010(而非 Server 2010)附带的字段类型生成代码,这意味着不包括服务器版本中发布功能所使用的一些特殊字段类型。

解决方法1:
扩展 SPMetal 以涵盖此类场景 — 就是使用 ICustomMapping 接口在 LINQ 模型中包含额外的字段。

http://msdn.microsoft.com/en-us/library/ee538669.aspx 解决方法

2:
检查此 SPMetal 文档 http://msdn.microsoft.com/en-us/library /ee535056.aspx 并查看 Column Elment 部分,该部分解释了如何使用 SPMetal 的 XML 参数文件来添加未生成的列。

http://social. technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/402f59d2-7365-4047-b194-057e84c0cf57/

By default, SPMetal generates code only for field types that ship with SharePoint Foundation 2010 (not Server 2010), which means some of the special field types used by publishing features in the server version are not included.

Workaround 1:
Extending SPMetal to cover scenarios like this — is to use the ICustomMapping interface to include extra fields in your LINQ model.

http://msdn.microsoft.com/en-us/library/ee538669.aspx

Workaround 2:
Check this SPMetal documentatin http://msdn.microsoft.com/en-us/library/ee535056.aspx and look at Column Elment section that explains how you can use the XML paramter file for SPMetal to add columns that were not generated.

http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/402f59d2-7365-4047-b194-057e84c0cf57/

不一样的天空 2024-10-16 15:07:19

我遇到了一个问题,SPMetal 没有为我生成列,答案是我的列表来自内容类型,但该列是单独添加的。如果列表来自内容类型,则 SPMetal 仅为来自该内容类型的列生成 C# 属性。

有关无法生成列的所有原因的参考:

http://msdn。 microsoft.com/en-us/library/ee537010.aspx

查看“代表列表列的属性”

I had a problem where SPMetal was not generating a column for me, and the answer was that my list had come from a Content Type, but the column had been added separately. If a list comes from a Content Type, SPMetal only generates C# properties for columns that come from that Content Type.

For reference on all reasons why a column may not be generated:

http://msdn.microsoft.com/en-us/library/ee537010.aspx

look under "Properties That Represent List Columns"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文