我必须审核对实体的更改,并了解如何获取所有值,但我不知道如何从实体管理器获取实体以订阅对其的更改。这是我尝试过的。
// assume tblMw is an order entity attached to an EntityManager.
manager.metadataStore("tblMw").entityAspect.propertyChanged.subscribe(
function (propertyChangedArgs) {
// this code will be executed anytime a property value changes on the 'order' entity.
var entity = propertyChangedArgs.entity; // Note: entity === order
var propertyNameChanged = propertyChangedArgs.propertyName;
var oldValue = propertyChangedArgs.oldValue;
var newValue = propertyChangedArgs.newValue;
if (!entity.entityAspect.validateProperty(propertyNameChanged)) {
//Property is not valid. Inform the user if needed.
}
});
我无法直接访问 tblMw。