私は JayData を初めて使用します。JayData で使用したい OData サービスがあります。この機能があります。
$data.initService('/odata')
.then(function (context) {
// manage your data through context with JSLQ
context.Store.forEach(function (s) {
alert(s.Name);
})
});
しかし、私は私のモデルが foreach に到達することはありません
public class Product
{
public int ID { get; set; }
public string Name { get; set; }
}
public class Store
{
public int ID { get; set; }
public string Name { get; set; }
public List<Product> Products { get; set; }
}
JaySvcUtil を使用するように変更しました - エンティティ モデルを生成しましたが、サーバーに送られるとエラー 500 が発生し、text/plain が使用されます。
var oProviderConfig = {
name: 'oData',
oDataServiceHost: 'http://localhost:16894/odata'
};
var c = new $data.generatedContexts[0](oProviderConfig);
c.onReady(function () {
c._Store.forEach(function (s) {
alert(s.Name);
});
});
GET 500 Internal Server Error text/plain datajs-1.1.0.js:2484 Script 358 B 0 B