0

breeze.js(マスターブランチ)を使用し、サーバー側でodata4jを使用してクライアントでangularを使用すると、国を照会したい場合に次のエラーが発生します。

var query = breeze.EntityQuery.from('Country');
entityManager.executeQuery(query).then(...).fail(...);

-> Unable to locate a 'Type' by the name: Country:#odataContainer 

私は次のようにそよ風を設定しました:

  breeze.config.initializeAdapterInstances({dataService: "OData"});
  breeze.NamingConvention.none.setAsDefault();

... / $ metadata OData応答:

<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
 <edmx:DataServices m:DataServiceVersion="2.0" xmlns:m="...">
   <Schema Namespace="odataContainer" xmlns="...">
     <EntityContainer Name="odataEntities" m:IsDefaultEntityContainer="true">
       <EntitySet Name="Country" EntityType="odataModel.Country">
       </EntitySet>
     </EntityContainer>
   </Schema>
   <Schema Namespace="odataModel" xmlns="...">
     <EntityType Name="Country">
       <Key>
         <PropertyRef Name="countryCode"></PropertyRef>
       </Key>
       <Property Name="region" Type="Edm.String" Nullable="true"></Property>
       <Property Name="population" Type="Edm.Int32" Nullable="false"></Property>
       <Property Name="countryCode" Type="Edm.String" Nullable="false"></Property>
       <Property Name="name" Type="Edm.String" Nullable="true"></Property>
     </EntityType>
   </Schema>
 </edmx:DataServices>
</edmx:Edmx>
4

1 に答える 1

0

プロジェクトにモデルの名前空間を含める必要があります。Countryクラスが含まれている場合は、サービスodataModel.Countryを構成するために3行目を追加する必要があります。oData

ODataModelBuilder builder = new ODataConventionModelBuilder();
builder.EntitySet<Department>("Countries");
builder.Namespace = "odataModel.Country"; 
于 2013-04-18T17:30:04.933 に答える