我唯一能找到的关于微风.js 中枚举支持的内容是关于 uservoice 的这个功能建议,最近在 0.82 中被标记为关闭。我正在使用当前最新的 0.84.3。
更新: 我首先在 EF 5.0.0 和 .net 4.5 中使用代码。启动应用程序和微风请求元数据时,EF 创建空数据库,我的枚举属性在数据库中为 int,所以这部分没问题。
但是,当我向模型中添加枚举属性时,当微风尝试解析元数据时出现异常:
Uncaught Error: Unable to locate an 'Type' by the name: ItemType:#TestApp.Models breeze.debug.js:5051
getTypeFromMap breeze.debug.js:5051
ctor.getEntityType breeze.debug.js:5028
ctor._updateProperty breeze.debug.js:6056
ctor._fixup breeze.debug.js:6133
ctor._fixup breeze.debug.js:6132
ctor.addEntityType breeze.debug.js:4702
convertFromODataEntityType
这是我的模型(简化):
public enum ItemType
{
Ordered,
Approved,
Misc
}
public class Item
{
public long Id { get; set; }
public ItemType Type { get; set; }
}
我在哪里犯错?是否有带枚举的工作样本?