Tuesday, 15 February 2011

breeze - entity level validator not triggered -



breeze - entity level validator not triggered -

i've observed when i'm adding entity collection of entity, validator sec entity not called.

i expected adding kid collection triggers entity level validation on parent when savechanges called.

i can't write test right now, if needed i'll write afternoon.

is expected behaviour or bug?

entity.orderline().arraychanged.subscribe(function (args) { console.log(args); if (args.added && args.added.some(function (element) { console.log(element.entityaspect.entitystate.name); homecoming !(element.entityaspect.entitystate.isunchanged() || element.entityaspect.entitystate.isdeleted()); })) { console.log("modifico"); entity.entityaspect.setmodified(); } if (args.removed && args.removed.some(function (element) { console.log(element.entityaspect.entitystate.name); homecoming !element.entityaspect.entitystate.isadded(); })) { console.log("modifico"); entity.entityaspect.setmodified(); } });

the parent not changed automatically add-on of kid because no info property of parent changes. technical reason.

sometimes (often?) model semantics parent is changed addition/deletion/change-to child. not true why breeze doesn't propagate alter automatically. true ... , think thought breeze back upwards if specify desired behavior in metadata. not lone in wanting this.

i've added a user voice suggestion idea; please vote if (and add together comments) if matters you.

meanwhile, in entity initializer can subscribe changes in parent collection , items of collection , have them set parent "modified" state (parent.entityaspect.setmodified()). have i'm afraid.

breeze

No comments:

Post a Comment