【问题标题】:breeze.js - help understanding getEntityTypes, IStructuralType, and EntityType casting微风.js - 帮助理解 getEntityTypes、IStructuralType 和 EntityType 转换
【发布时间】:2014-08-11 13:09:01
【问题描述】:

提前感谢您提供的任何帮助。

我正在使用 TypeScript 并正在使用微风.EntityManager.metadataStore.getEntityTypes()

这会返回微风.IStructuralType[]

对于数组中的特定项目,我想要导航属性列表。我可以看到这是对象的属性。如果我将项目转换为微风,我可以得到它。EntityType

(<breeze.EntityType>myItem).navigationProperties
  1. 是否有任何其他非 EntityType 对象可以从 getEntityTypes 返回?
  2. 有比演员表更好的方法吗?

再次感谢, -迈克·格雷厄姆

【问题讨论】:

    标签: typescript odata breeze


    【解决方案1】:

    metadataStore.getEntityTypes() 方法返回元数据中表示的所有类型,包括EntityTypeComplexType 定义。

    EntityTypes 有导航属性; ComplexTypes不要。见this page in the Breeze docs for more about ComplexTypes

    你可以做演员,但首先你应该检查myItem instanceof EntityType

    【讨论】:

      【解决方案2】:

      如果它出现在所有 breeze.IStructuralType 上,你可以告诉 typescript :

      declare module breeze{
          interface IStructuralType{
               navigationProperties: any[]; // or what have you
          }
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-12-26
        • 1970-01-01
        • 1970-01-01
        • 2021-11-06
        • 1970-01-01
        • 2015-06-26
        • 2018-08-18
        相关资源
        最近更新 更多