In my spa I need to send a complex object tree to the client and let the user fill in his data, before the entities can be saved in the database. So the entities do not exist in the database at that moment. The object tree is constructed in memory on the server and simply fetched by a call to breeze.EntityQuery.from("ComplexeObjectTree")
. The entities a bound via knockout to a web form. The user than enters the required data first, before he can push the save button. Some of the entities properties in the form are optional and have default values. If the user doesn’t change these properties, beeze will not detect any changes and will not put its owning entities into the change set. They are marked unchanged but their id values are still -1
(not saved yet). But the database save can only be executed successfully, when all entities in the object tree including their relations have been send to the server (to respect database constrains). The save operation should result in one or multiple insert statements, also for those entities that have not changed on the client, but are new to the database (id==-1
). How can I handle this use case? Shouldn’t all entities with primary key id==-1
marked as Added and be part of the save change set by default?
Any help is very much appreciated,
Andreas