在两个实体之间有非常简单的关系,我试图用asp.net webapi odata控制器公开它们,但似乎$元数据有问题.
当我在$元数据上运行jaydatasvcutil.exe时,我收到警告:inverseProperty其他方面缺失.
当我使用breezejs loadNavigationProperty时,我得到类似的错误.
即使有官方的例子我也有问题. http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/working-with-entity-relations
你可以在这里观察$元数据http://sdrv.ms/Z5Klfw
请帮忙.
我正在尝试使用以下层开发应用程序:
该模型包含继承和多态集合:
public class Master
{
public virtual ICollection<BaseDetail> Details { get; set; }
}
public abstract class BaseDetail
{
public virtual Master Master { get; set; }
}
public class Detail1 : BaseDetail { }
public class Detail2 : BaseDetail { }
public class Detail3 : BaseDetail { }
Run Code Online (Sandbox Code Playgroud)
问题是我找不到适合我需要的Java Script框架:
如何用BreezeJS + OData或WebAPI编写复杂的查询?我希望能够在JayData中使用Northwind作为参考db吗?我的问题是我不知道如何表达两侧都引用数据库的查询(不是与常量相比的字段),还有复杂的逻辑树(a ||(b && c))?
context.Products.filter(function(product) {
return (product.Unit_Price < product.Category.BudgetPriceLimit) ||
(product.Category.IsOnSale && product.Supplier.IsFavored)
}).toArray(...)
Run Code Online (Sandbox Code Playgroud)
我的另一个问题是关于TypeScript +查询.如何使用箭头函数进行BreezeJS查询?因此,有一种方式可以说:而不是表达式构建器:
query(Product => Product.Unit_Price < Product.Category.BudgetPriceLimit)
Run Code Online (Sandbox Code Playgroud)
感谢您的帮助,对不起,如果这些是明显的问题.
刚开始玩JayData lib.并希望获得TypeScript的好处.我已经在我的VS2013项目中包含以下文件: - jaydata.js - jaydata.d.ts - JayDataContext.js,使用JaySvcUtil(v.1.3.5)创建 - JayDataContext.d.ts,使用JaySvcUtil创建
1) There is a compile error in jaydata.d.ts, line 2
interface IPromise<T> extends Object {
Error 1 Interface '$data.IPromise<T>' cannot extend interface 'Object':
Types of property 'valueOf' of types 'IPromise<T>' and 'Object' are incompatible:
Call signatures of types '() => any' and '() => Object' are incompatible. C:\Users\robbin\documents\visual studio 2013\Projects\TypeScriptHTMLApp1\TypeScriptHTMLApp1\scripts\jaydata.d.ts 2 15 TypeScriptHTMLApp1
2)There are a lot of compile errors in JayDataContext.ts beacuse '$data.IPromise' it is not 'used' as generic …Run Code Online (Sandbox Code Playgroud)