本地 SharePoint BDC 实体定义错误

发布于 2024-08-07 20:39:11 字数 5045 浏览 6 评论 0原文

我正在尝试为 SharePoint BDC 创建自己的应用程序定义 xml 文件,主要是因为我想更熟悉这些概念。我的应用程序使用内部 Oracle 数据库,它仅包含一个实体,该实体旨在仅从单个数据库表中检索列的子集。该实体(“分析光谱”)仅包含一种带有一个输入参数的 Finder 方法,该方法也用作过滤器。

这是我的实体:

<Entity EstimatedInstanceCount="0" Name="CHEMREG.CHEMREG_SPECTRA" DefaultDisplayName="Analytical Spectra">
  <Identifiers>
    <Identifier TypeName="System.Decimal" Name="SPECTRA_ID" DefaultDisplayName="SPECTRA_ID" />
  </Identifiers>
  <Methods>
    <Method Name="GetSpectra">
      <Properties>
        <Property Name="RdbCommandText" Type="System.String">SELECT SPECTRA_ID,
                                                                    BATCH_ID,
                                                                    CREATED_BY,
                                                                    CREATED_DATE,
                                                                    FILE_NAME,
                                                                    COMMENTS,
                                                                    NOTEBOOK_REF,
                                                                    FINAL,
                                                                    PDF_PATH,
                                                                    CHEMIST 
                                                             FROM CHEMREG.CHEMREG_SPECTRA
                                                             WHERE NOTEBOOK_REF LIKE :Notebook_Ref                                                                       
        </Property>
        <Property Name="RdbCommandType" Type="System.Data.CommandType">Text</Property>
      </Properties>
      <FilterDescriptors>
        <FilterDescriptor Type="Wildcard" Name="Notebook Ref" />
      </FilterDescriptors>
      <Parameters>
        <Parameter Direction="In" Name=":Notebook_Ref">
          <TypeDescriptor TypeName="System.String"
                          Name="NOTEBOOK_REF"
                          AssociatedFilter="Notebook Ref">
          </TypeDescriptor>
        </Parameter>
        <Parameter Direction="Return" Name="CHEMREG_SPECTRA">
          <TypeDescriptor TypeName="System.Data.IDataReader, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" Name="CHEMREG_SPECTRADataReader">
            <TypeDescriptors>
              <TypeDescriptor TypeName="System.Data.IDataRecord, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="CHEMREG_SPECTRADataRecord">
                <TypeDescriptors>
                  <TypeDescriptor TypeName="System.Decimal" Name="SPECTRA_ID" IdentifierName="SPECTRA_ID" DefaultDisplayName="Spectra ID" />
                  <TypeDescriptor TypeName="System.String" Name="BATCH_ID" DefaultDisplayName="Batch ID" />
                  <TypeDescriptor TypeName="System.String" Name="CREATED_BY" DefaultDisplayName="Created By"/>
                  <TypeDescriptor TypeName="System.String" Name="CREATED_DATE" DefaultDisplayName="Created Date" />
                  <TypeDescriptor TypeName="System.String" Name="FILE_NAME" DefaultDisplayName="File Name" />
                  <TypeDescriptor TypeName="System.String" Name="COMMENTS" DefaultDisplayName="Comments" />
                  <TypeDescriptor TypeName="System.String" Name="NOTEBOOK_REF" AssociatedFilter="Notebook Ref" DefaultDisplayName="Notebook Ref" />
                  <TypeDescriptor TypeName="System.Decimal" Name="FINAL" DefaultDisplayName="Final" />
                  <TypeDescriptor TypeName="System.String" Name="PDF_PATH" DefaultDisplayName="PDF Path" />
                  <TypeDescriptor TypeName="System.String" Name="CHEMIST" DefaultDisplayName="Chemist" />
                </TypeDescriptors>
              </TypeDescriptor>
            </TypeDescriptors>
          </TypeDescriptor>
        </Parameter>
      </Parameters>
      <MethodInstances>
        <MethodInstance Name="CHEMREG_SPECTRAFinder" Type="Finder" ReturnParameterName="CHEMREG_SPECTRA" ReturnTypeDescriptorName="CHEMREG_SPECTRADataReader" ReturnTypeDescriptorLevel="0" />
      </MethodInstances>
    </Method>
  </Methods>
</Entity>

我的应用程序可以很好地上传到 BDC(带有无法找到 SpecificFinder 的警告,但我认为这没什么大不了的......是吗?)。当我将业务数据列表 Web 部件添加到页面并选择要显示的“分析光谱”实体时,我在 UI 中收到错误消息:

从分析光谱检索数据时发生错误。管理员请参阅服务器日志以获取更多信息。

服务器日志包含以下信息,我觉得这些信息令人困惑:

实例化筛选器类型时出错:Microsoft.Office.Server.ApplicationRegistry.Runtime.WildcardFilter ... 内部异常1: System.Reflection.TargetInitationException:调用目标已引发异常。 ---> System.InvalidOperationException:无法在 DirectionType 为“Out”、“Return”或“SqlReturn”的参数上创建默认实例

我对此感到困惑,因为它似乎在抱怨我的返回参数上的过滤器,并且我还没有定义过滤我的返回参数。我搞砸了什么?

I am trying to create my own application definition xml file for the SharePoint BDC, mostly because I want to become more familiar with the concepts. My application uses an in-house Oracle database, and it contains only one entity which is intended to just retrieve a subset of columns from a single database table. The entity ("Analytical Spectra") contains just one Finder method with one input parameter which is also used as a filter.

Here's my entity:

<Entity EstimatedInstanceCount="0" Name="CHEMREG.CHEMREG_SPECTRA" DefaultDisplayName="Analytical Spectra">
  <Identifiers>
    <Identifier TypeName="System.Decimal" Name="SPECTRA_ID" DefaultDisplayName="SPECTRA_ID" />
  </Identifiers>
  <Methods>
    <Method Name="GetSpectra">
      <Properties>
        <Property Name="RdbCommandText" Type="System.String">SELECT SPECTRA_ID,
                                                                    BATCH_ID,
                                                                    CREATED_BY,
                                                                    CREATED_DATE,
                                                                    FILE_NAME,
                                                                    COMMENTS,
                                                                    NOTEBOOK_REF,
                                                                    FINAL,
                                                                    PDF_PATH,
                                                                    CHEMIST 
                                                             FROM CHEMREG.CHEMREG_SPECTRA
                                                             WHERE NOTEBOOK_REF LIKE :Notebook_Ref                                                                       
        </Property>
        <Property Name="RdbCommandType" Type="System.Data.CommandType">Text</Property>
      </Properties>
      <FilterDescriptors>
        <FilterDescriptor Type="Wildcard" Name="Notebook Ref" />
      </FilterDescriptors>
      <Parameters>
        <Parameter Direction="In" Name=":Notebook_Ref">
          <TypeDescriptor TypeName="System.String"
                          Name="NOTEBOOK_REF"
                          AssociatedFilter="Notebook Ref">
          </TypeDescriptor>
        </Parameter>
        <Parameter Direction="Return" Name="CHEMREG_SPECTRA">
          <TypeDescriptor TypeName="System.Data.IDataReader, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" Name="CHEMREG_SPECTRADataReader">
            <TypeDescriptors>
              <TypeDescriptor TypeName="System.Data.IDataRecord, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="CHEMREG_SPECTRADataRecord">
                <TypeDescriptors>
                  <TypeDescriptor TypeName="System.Decimal" Name="SPECTRA_ID" IdentifierName="SPECTRA_ID" DefaultDisplayName="Spectra ID" />
                  <TypeDescriptor TypeName="System.String" Name="BATCH_ID" DefaultDisplayName="Batch ID" />
                  <TypeDescriptor TypeName="System.String" Name="CREATED_BY" DefaultDisplayName="Created By"/>
                  <TypeDescriptor TypeName="System.String" Name="CREATED_DATE" DefaultDisplayName="Created Date" />
                  <TypeDescriptor TypeName="System.String" Name="FILE_NAME" DefaultDisplayName="File Name" />
                  <TypeDescriptor TypeName="System.String" Name="COMMENTS" DefaultDisplayName="Comments" />
                  <TypeDescriptor TypeName="System.String" Name="NOTEBOOK_REF" AssociatedFilter="Notebook Ref" DefaultDisplayName="Notebook Ref" />
                  <TypeDescriptor TypeName="System.Decimal" Name="FINAL" DefaultDisplayName="Final" />
                  <TypeDescriptor TypeName="System.String" Name="PDF_PATH" DefaultDisplayName="PDF Path" />
                  <TypeDescriptor TypeName="System.String" Name="CHEMIST" DefaultDisplayName="Chemist" />
                </TypeDescriptors>
              </TypeDescriptor>
            </TypeDescriptors>
          </TypeDescriptor>
        </Parameter>
      </Parameters>
      <MethodInstances>
        <MethodInstance Name="CHEMREG_SPECTRAFinder" Type="Finder" ReturnParameterName="CHEMREG_SPECTRA" ReturnTypeDescriptorName="CHEMREG_SPECTRADataReader" ReturnTypeDescriptorLevel="0" />
      </MethodInstances>
    </Method>
  </Methods>
</Entity>

My application can be uploaded into the BDC just fine (with the warning that the SpecificFinder couldn't be found, but I didn't think that was a big deal here... is it?). When I add a Business Data List Web Part to a page and choose my "Analytical Spectra" entity for display, I get an error in the UI that says:

An error occurred while retrieving data from Analytical Spectra. Administrators, see the server log for more information.

The server log contains this information, which I find confusing:

Error while instantiating Filter Type: Microsoft.Office.Server.ApplicationRegistry.Runtime.WildcardFilter
...
Inner exception 1:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Cannot create default instance on a Parameter with DirectionType 'Out', 'Return' or 'SqlReturn'

I am confused by this because it seems to be complaining about a filter on my return parameter, and I haven't defined a filter on my return parameter. What am I screwing up?

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

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

发布评论

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

评论(1

<逆流佳人身旁 2024-08-14 20:39:11

啊哈。问题是返回类型定义中的此条目:

<TypeDescriptor TypeName="System.String" 
                Name="NOTEBOOK_REF" 
                AssociatedFilter="Notebook Ref"
                DefaultDisplayName="Notebook Ref" />

输出类型定义不应引用过滤器。类型描述符应该是:

<TypeDescriptor TypeName="System.String" 
                Name="NOTEBOOK_REF" 
                DefaultDisplayName="Notebook Ref" />

进行更改后就像魅力一样。

Ah, ha. The problem was this entry in the return type definition:

<TypeDescriptor TypeName="System.String" 
                Name="NOTEBOOK_REF" 
                AssociatedFilter="Notebook Ref"
                DefaultDisplayName="Notebook Ref" />

The output type definition shouldn't refer to a filter. The type descriptor should instead have been:

<TypeDescriptor TypeName="System.String" 
                Name="NOTEBOOK_REF" 
                DefaultDisplayName="Notebook Ref" />

Works like a charm after making that change.

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