调用微风setDetached()上的实体移除getValidationErrors() [英] Calling Breeze setDetached() on an entity removed the getValidationErrors()

查看:125
本文介绍了调用微风setDetached()上的实体移除getValidationErrors()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它是一个预期的行为验证对实体数组是当实体分离或破坏,如果你创建一个实体,你不把它添加到管理器(所以它是一个独立状态),它没有验证你的模型设定?这是因为我的基础上选择或创建实体动态创建形式角度和微风问题,我需要这些验证

Is it an expected behaviour that the array of validations on the entity is destroy when the entity is detached or if you create an entity and you don't add it to the manager (so it's in a 'detached' state), it doesn't have the validation set on your model ? This is problematic as I am creating a form dynamically with angular and breeze based on the entity selected or created and I need those validations

推荐答案

是的,这是正确的。一个离散的实体不会验证属性发生变化,因为它不知道这些变化。实体管理器则负责看属性更改和分离实体(定义)没有一个EntityManager。

Yes, that is correct. A detached entity does not validate property changes because it is not aware of those changes. The EntityManager is responsible for watching property changes and a detached entity (by definition) does not have an EntityManager.

这也是一个事实,即分离的实体清除它恰巧有任何验证错误。我不知道为什么我们选择了这种行为(我敢肯定有一个很好的理由)。我只能报告,它是如此。

It is also a fact that detaching an entity clears any validation errors it happens to have. I don't know why we chose that behavior (I'm sure there is a good reason). I can only report that it is so.

您可以通过调用强制分离实体的审定 detachedEntity.entityAspect.validateEntity();

You can force validation of a detached entity by calling detachedEntity.entityAspect.validateEntity();

这些行为上的文件code样品的的 validationTests.js 的显示屏 - 拆实体清除验证错误

These behaviors are on display in the DocCode sample's validationTests.js - "Detaching entity clears validation errors".

现在问你一个问题:你为什么要创建和绑定分离实体

And now a question for you: why are you creating and binding to a detached entity?

这篇关于调用微风setDetached()上的实体移除getValidationErrors()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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