jaysvcutil 失败,出现类型错误:无法读取未定义的属性'schemas'



我试图通过jaysvcutil从现有的OData服务生成模型,并且我得到:

[...]node_modulesjaydata-odatajslibodataodatautils.js:385
            throw err;
            ^
TypeError: Cannot read property 'schemas' of undefined
    at Metadata.processMetadata ([...]node_modulesjaydata-dynamic-metadatalibmetadata.js:353:35)
    at requestData ([...]node_modulesjaydata-dynamic-metadatalibmetadataHandler.js:46:42)
    at [...]node_modulesjaydata-odatajslibodataodatautils.js:382:13
    at IncomingMessage.<anonymous> ([...]node_modulesjaydata-odatajslibodatanet.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团队的反馈:

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.

因此,我将寻找替代方案,大概是breezejs。

相关内容

  • 没有找到相关文章

最新更新