微风是偏 [英] Breeze isPartial

查看:68
本文介绍了微风是偏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前正在使用John Papa的热毛巾,我当前遇到一个奇怪的错误:

Currently playing with John Papa's Hot Towel, I am currently having a strange error:

TypeError: Object [object Object] has no method 'isPartial'

我一直在研究isPartial,但是没有成功。
我所做的就是创建一种新的实体。

I have been looking into this isPartial thing but without success. All I've done is create a new kind of entity.

我不知道是否应该提供更多有关此问题的信息。
请帮忙!

I don't know if I should provide more information for this problem. Please help!

谢谢:)

以下是完整错误:

"TypeError: Object [object Object] has no method 'isPartial'
at proto.setProperty (http://localhost:13763/scripts/breeze.debug.js:13153:31)
at http://localhost:13763/scripts/breeze.debug.js:5833:30
at Object.objectForEach (http://localhost:13763/scripts/breeze.debug.js:311:17)
at proto.createEntity (http://localhost:13763/scripts/breeze.debug.js:5832:22)
at proto.createEntity (http://localhost:13763/scripts/breeze.debug.js:9876:18)
at dtoToEntityMapper (http://localhost:13763/App/services/breeze.partial-entities.js:32:38)
at Array.map (native)
at Object.mapDtosToEntities (http://localhost:13763/App/services/breeze.partial-entities.js:23:25)
at querySucceeded (http://localhost:13763/App/services/datacontext.js:64:42)

From previous event:
at Object.getMyEntities (http://localhost:13763/App/services/datacontext.js:60:18)
at Object.activate (http://localhost:13763/App/viewmodels/home.js:6:32)
at activate (http://localhost:13763/App/durandal/viewModel.js:74:38)
at Object.<anonymous> (http://localhost:13763/App/durandal/viewModel.js:231:37)
at Object.<anonymous> (http://localhost:13763/scripts/jquery-1.9.1.min.js:3:9221)
at c (http://localhost:13763/scripts/jquery-1.9.1.min.js:3:7857)
at Object.p.add [as done] (http://localhost:13763/scripts/jquery-1.9.1.min.js:3:8167)
at Array.<anonymous> (http://localhost:13763/scripts/jquery-1.9.1.min.js:3:9198)"


推荐答案

是否需要更多信息来诊断。元数据中是否有新类型?您是否为定义了 isPartial ,就像CCJS在 model.js 〜ln#36吗?

Would need more info to diagnose. Is the new type in metadata? Did you create a custom constructor for your type that defines isPartial, as CCJS does in model.js ~ln #36?


// Pass the Type, Ctor (breeze tracks properties created here), and initializer 
 metadataStore.registerEntityTypeCtor(
      'Session', function () { this.isPartial = false; }, sessionInitializer);

您可以通过下面的示例,基于 DocCode示例

You can find out if you've successfully added a property to a type by following this example based on a test method in "entityExtensionTests" of the DocCode sample:


function assertFooPropertyIsUnmappedPropertyOfCustomer(manager) {
    var custType = manager.metadataStore.getEntityType("Customer");
    var fooProp = custType.getDataProperty('foo');
    ok(fooProp && fooProp.isUnmapped,
       "'foo' property should be defined as unmapped property after registration.");
}

Btw,在即将到来的Breeze v.1.3.2中,有更简单的方法来绘制局部图像-像平面投影这些-使用 EntityQuery.toType()转换为 EntityType 。您仍然需要在类型中添加 isPartial

Btw, in the forthcoming Breeze v.1.3.2 there is much easier way to map partials - flat projections like these - into an EntityType using EntityQuery.toType(). You would still need to add isPartial to the type.

这篇关于微风是偏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆