【问题标题】:jaysvcutil failing with TypeError: Cannot read property 'schemas' of undefinedjaysvcutil 因 TypeError 失败:无法读取未定义的属性“模式”
【发布时间】:2016-08-29 14:56:20
【问题描述】:

我正在尝试通过 jaysvcutil 从现有的 OData 服务生成模型并得到:

[...]\node_modules\jaydata-odatajs\lib\odata\odatautils.js:385
            throw err;
            ^

TypeError: Cannot read property 'schemas' of undefined
    at Metadata.processMetadata ([...]\node_modules\jaydata-dynamic-metadata\lib\metadata.js:353:35)
    at requestData ([...]\node_modules\jaydata-dynamic-metadata\lib\metadataHandler.js:46:42)
    at [...]\node_modules\jaydata-odatajs\lib\odata\odatautils.js:382:13
    at IncomingMessage.<anonymous> ([...]\node_modules\jaydata-odatajs\lib\odata\net.js:179:21)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:921:12)
    at nextTickCallbackWith2Args (node.js:442:9)
    at process._tickCallback (node.js:356:17)

我试图将域模型压缩成非常简单的东西,所以我当前的 $metadata 看起来像这样:

<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" Version="1.0">
    <edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="1.0">
        <Schema xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://schemas.microsoft.com/ado/2007/05/edm" Namespace="data">
            <EntityType Name="Product">
                <Key>
                    <PropertyRef Name="ProductId"/>
                </Key>
                <Property Name="ProductId" Type="Edm.Int64" Nullable="false"/>
                <Property Name="ProductNo" Type="Edm.String" Nullable="true"/>
                <Property Name="LifeTime" Type="Edm.Int64" Nullable="false"/>
                <Property Name="Capacity" Type="Edm.Int64" Nullable="false"/>
                <Property Name="PackingSize" Type="Edm.Int64" Nullable="false"/>
                <Property Name="CreationTime" Type="Edm.DateTime" Nullable="false"/>
                <Property Name="ModificationTime" Type="Edm.DateTime" Nullable="false"/>
            </EntityType>
        </Schema>
        <Schema xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://schemas.microsoft.com/ado/2007/05/edm" Namespace="Namespace">
            <EntityContainer Name="DomainData" m:IsDefaultEntityContainer="true">
                <EntitySet Name="Product" EntityType="data.Product"/>
            </EntityContainer>
        </Schema>
    </edmx:DataServices>
</edmx:Edmx>

这是一个现有的基于 WCF DataService 的 OData 提供程序,使用 OData V1,我无法更改它 - 所以请不要建议将提供程序更新到 V4。

任何帮助将不胜感激。

【问题讨论】:

    标签: jaydata


    【解决方案1】:

    根据 JayData 团队的反馈:

    JayData supports OData v4, as there have been multiple breaking changes in both OData and DataJS since v1.
    

    还有

    JayData 1.3.7 supports v2 and v3, but it does not support TypeScript and Angular 2.
    

    因此,我将寻找替代品,大概是轻风。

    【讨论】:

      猜你喜欢
      • 2019-02-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-11
      • 1970-01-01
      相关资源
      最近更新 更多