breezejs с ошибкой odata (odata4j)

Используя breeze.js (основная ветка) и angular на клиенте с odata4j на стороне сервера, я получаю следующую ошибку, если хочу запросить страны:

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>

person Devel Operdevfour    schedule 25.03.2013    source источник


Ответы (1)


Вам необходимо включить пространство имен для ваших моделей в ваш проект. Если ваш класс Country относится к классу odataModel.Country, вам нужно добавить третью строку для настройки службы oData:

ODataModelBuilder builder = new ODataConventionModelBuilder();
builder.EntitySet<Department>("Countries");
builder.Namespace = "odataModel.Country"; 
person mbenothmane    schedule 18.04.2013