在具有complexTypes集合的实体上调用rejectChanges会使集合中的complexTypes加倍 [英] Calling rejectChanges on a entity with collection of complexTypes doubles the complexTypes in collection

查看:95
本文介绍了在具有complexTypes集合的实体上调用rejectChanges会使集合中的complexTypes加倍的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是我做错了,但我遇到了一个我认为可重复的问题。它可能是设计的,但现在我无法弄清楚如何绕过它。

This may be something I am doing wrong, but I am having an issue that I believe is repeatable. It may be by design, but right now I can't figure out how to get around it.

我有一个实体,上面有一些complexType数组。如果我将一个新的complexType推入数组,我会在集合中看到正确数量的对象。如果我在父实体上调用rejectChanges,它将删除新的complexType,然后复制该数组中的所有对象。

I have an entity with a few complexType arrays on them. If I push a new complexType into the array, I see the correct number of objects in the collection. If I call rejectChanges on the parent entity, it removes the new complexType but then copies all of the objects in that array.

示例元数据 -

metadataStore.addEntityType({
    shortName: "Person",
    namespace: "MyNameSpace",
    dataProperties: {
        id: { dataType: "String", isPartOfKey: true },
        emails: { complexTypeName: "Email:#MyNameSpace", isScalar: false }
    }
});

metadataStore.addEntityType({
    shortName: "Email",
    namespace: "MyNameSpace",
    isComplexType: true,
    dataProperties: {
        id: { dataType: "String" },
        text: { dataType: "String" },
        preferred: { dataType: "Boolean" }
    }
});

重现的步骤 -


  1. 创建实体

  2. 添加两种复杂类型的电子邮件

  3. 保存所有更改

  4. 添加另一种复杂类型的电子邮件

  5. 在父实体上调用entityAspect.rejectChanges()

  6. 查看现在数组中的电子邮件数

  1. Create an entity
  2. Add two complex types of email
  3. Save all changes
  4. Add another complex type of email
  5. Call entityAspect.rejectChanges() on the parent entity
  6. Look at the number of emails in the array now

我假设在步骤1-3中这仍然会重现问题,现在我从服务器获取实体和复杂类型所以我只做了4-6步。

I assume on steps 1-3 this will still reproduce the issue, right now I am getting the entity and the complex types from the server so I am only doing steps 4-6.

注意

我试过调用rejectChanges取决于complexAspect但它不存在。

I tried calling rejectChanges on the complexAspect instead but it doesn't exist.

我在电子邮件列表上有一个ko.computed返回'首选',将其他人设置为false,不知道这是否有所贡献

I have a ko.computed on the list of emails to return the 'preferred' one that sets the others to false, don't know if this is contributing

我正在对DOM中的电子邮件列表进行排序

I am sorting the list of emails in the DOM

修改

刚刚发现同样的事情删除其中一个复杂类型并取消该更改时发生。

Just found that the same thing occurs when deleting one of the complex types and cancelling that change.

推荐答案

很抱歉这个问题花了这么长时间。它滑落了...它现在在当前的GitHub回购中,并将在下一个版本中发布。

Sorry for taking so long on this one. It slipped... It is now in the current GitHub repo and will go out with the next release.

这篇关于在具有complexTypes集合的实体上调用rejectChanges会使集合中的complexTypes加倍的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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