我正在尝试轻松运行,但我对这些东西不熟悉,所以我遇到了一些问题。
我的Metafata片段:
来自http://localhost:7048/DynamicsNAV71/OData/$metadata
<?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="1.0" m:MaxDataServiceVersion="3.0"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<Schema Namespace="NAV"
xmlns="http://schemas.microsoft.com/ado/2007/05/edm">
<EntityType Name="contact">
<Key>
<PropertyRef Name="No" />
</Key>
<Property Name="No" Type="Edm.String" Nullable="false" />
<Property Name="Type" Type="Edm.String" />
<Property Name="Company_No" Type="Edm.String" />
<Property Name="Company_Name" Type="Edm.String" />
<Property Name="IntegrationCustomerNo" Type="Edm.String" />
<Property Name="Name" Type="Edm.String" />
如果我设置: hasServerMetadata: true,
,则breeze尝试连接到:http://localhost:7048/DynamicsNAV71/OData/Company('CRONUS%20(Schweiz)%20AG')/Metadata
而不是它在哪里:
http://localhost:7048/DynamicsNAV71/OData/$metadata
我的Json片段来自
。 http://localhost:7048/DynamicsNAV71/OData/Company('CRONUS%20(Schweiz)%20AG')/customer?$format=json
{
"odata.metadata": "http://localhost:7048/DynamicsNAV71/OData/$metadata#customer",
"value": [
{
"No": "01121212",
"Name": "Spotsmeyer's Furnishings",
"Address": "612 South Sunset Drive",
"Address_2": "",
"Post_Code": "US-FL 37125",
我还尝试了以下内容:
var manager = new breeze.EntityManager({ dataService: dataService });
initializeMetadataStore(manager.metadataStore);
function initializeMetadataStore(metadataStore) {
var et = new breeze.EntityType({
shortName: "customer",
namespace: "what.Models"
});
et.addProperty( new breeze.DataProperty({
name: "No",
dataType: breeze.DataType.String,
isNullable: false,
isPartOfKey: true,
}));
et.addProperty(new breeze.DataProperty({
name: "Name",
dataType: breeze.DataType.String,
isNullable: true,
}));
et.addProperty(new breeze.DataProperty({
name: "Address",
dataType: breeze.DataType.String,
isNullable: true,
}));
metadataStore.addEntityType(et);
}
我尝试用以下内容显示它们:
<p data-bind="visible: !results">Fetching data ... </p>
<ul data-bind="foreach: results, visible: results" style="display:none">
<li>
<span data-bind="text:Name"></span>
</li>
</ul>
但我收到错误: Name not defined
如果我用值替换名称:<span data-bind="text:value"></span>
我可以看到一个含有大量object Objects
任何提示?
最好的问候
答案 0 :(得分:0)
您是否配置了微风适配器?
// "Standard" Web API OData source (e.g., WCF OData)
breeze.config.initializeAdapterInstance('dataService', 'odata', true);
或
// ASP.NET Web API OData
breeze.config.initializeAdapterInstance('dataService', 'webApiOData', true);
另请检查您是否使用camelCase
命名惯例
breeze.NamingConvention.camelCase.setAsDefault();