angularjs - Breeze wont detect entities changes -


i can't breeze.savechanges() detect entities changes. want create new order->orderdetails related entities, modify savechanges failing terribly, have breeze manager in factory named data , controller

angular.module("inventoryapp")     .controller("purchasesctrl", function ($scope, data, $log) {     var setfields=function(){         var product = data.createentity("product");         var purchaseorder=data.createentity("purchaseorder");         $scope.purchaseorder = purchaseorder;         $scope.product = product;  //binding entities view edits     };       $scope.save = function(product, purchaseorder) { //i calling view         purchaseorder.time = new date();         product.purchaseorders.push(purchaseorder); //creating relation         data.savechanges();   //breeze refuses save claim have no changes         setfields();   //binding new fresh enties     };      setfields(); //binding new entities view edits }); 

i have tried data.savechanges([product,purchaseorder]) relationship between product , purchase becomes lost , server returns validation error in purchaseorder must have valid product (it doesn't assosiate new product sent it?)

data.savechanges([product]) save product , ignore purchaseorder despite product.purchaseorders.push(purchaseorder); working.

using purchaseorder.product=product; instead of product.purchaseorders.push(purchaseorder); creating relation provides same story.

either ways relation appears perfect offline while debugging dev tools breeze manager haschanges frag wont turn true , server error above when send entities force.

i doubt metadata problem server generated kept on metadata.js , fed app during app.run here metadata.

{     "schema": {         "namespace": "inventory.api",         "alias": "self",         "annotation:usestrongspatialtypes": "false",         "xmlns:annotation": "http://schemas.microsoft.com/ado/2009/02/edm/annotation",         "xmlns:customannotation": "http://schemas.microsoft.com/ado/2013/11/edm/customannotation",         "xmlns": "http://schemas.microsoft.com/ado/2009/11/edm",         "cspaceospacemapping": "[\"inventory.api.product\",\"inventory.api.entities.product\"],[\"inventory.api.purchaseorder\",\"inventory.api.entities.purchaseorder\"],[\"inventory.api.sellorder\",\"inventory.api.entities.sellorder\"]",         "entitytype": [{             "name": "product",             "customannotation:clrtype": "inventory.api.entities.product, inventory.api, version=1.0.0.0, culture=neutral, publickeytoken=null",             "key": {                 "propertyref": {                     "name": "id"                 }             },             "property": [{                 "name": "id",                 "type": "edm.guid",                 "nullable": "false",                 "annotation:storegeneratedpattern": "identity"             }, {                 "name": "barcode",                 "type": "edm.string",                 "maxlength": "max",                 "fixedlength": "false",                 "unicode": "true"             }, {                 "name": "name",                 "type": "edm.string",                 "maxlength": "max",                 "fixedlength": "false",                 "unicode": "true"             }, {                 "name": "unitprice",                 "type": "edm.decimal",                 "precision": "18",                 "scale": "2",                 "nullable": "false"             }, {                 "name": "count",                 "type": "edm.decimal",                 "precision": "18",                 "scale": "2",                 "nullable": "false"             }],             "navigationproperty": [{                 "name": "purchaseorders",                 "relationship": "self.purchaseorder_product",                 "fromrole": "purchaseorder_product_target",                 "torole": "purchaseorder_product_source"             }, {                 "name": "sellorders",                 "relationship": "self.sellorder_product",                 "fromrole": "sellorder_product_target",                 "torole": "sellorder_product_source"             }]         }, {             "name": "purchaseorder",             "customannotation:clrtype": "inventory.api.entities.purchaseorder, inventory.api, version=1.0.0.0, culture=neutral, publickeytoken=null",             "key": {                 "propertyref": {                     "name": "id"                 }             },             "property": [{                 "name": "id",                 "type": "edm.guid",                 "nullable": "false",                 "annotation:storegeneratedpattern": "identity"             }, {                 "name": "time",                 "type": "edm.datetime",                 "nullable": "false"             }, {                 "name": "unitprice",                 "type": "edm.decimal",                 "precision": "18",                 "scale": "2",                 "nullable": "false"             }, {                 "name": "count",                 "type": "edm.decimal",                 "precision": "18",                 "scale": "2",                 "nullable": "false"             }, {                 "name": "totalprice",                 "type": "edm.decimal",                 "precision": "18",                 "scale": "2",                 "nullable": "false"             }],             "navigationproperty": {                 "name": "product",                 "relationship": "self.purchaseorder_product",                 "fromrole": "purchaseorder_product_source",                 "torole": "purchaseorder_product_target"             }         }, {             "name": "sellorder",             "customannotation:clrtype": "inventory.api.entities.sellorder, inventory.api, version=1.0.0.0, culture=neutral, publickeytoken=null",             "key": {                 "propertyref": {                     "name": "id"                 }             },             "property": [{                 "name": "id",                 "type": "edm.guid",                 "nullable": "false",                 "annotation:storegeneratedpattern": "identity"             }, {                 "name": "time",                 "type": "edm.datetime",                 "nullable": "false"             }, {                 "name": "unitprice",                 "type": "edm.decimal",                 "precision": "18",                 "scale": "2",                 "nullable": "false"             }, {                 "name": "count",                 "type": "edm.decimal",                 "precision": "18",                 "scale": "2",                 "nullable": "false"             }, {                 "name": "totalprice",                 "type": "edm.decimal",                 "precision": "18",                 "scale": "2",                 "nullable": "false"             }],             "navigationproperty": {                 "name": "product",                 "relationship": "self.sellorder_product",                 "fromrole": "sellorder_product_source",                 "torole": "sellorder_product_target"             }         }],         "entitycontainer": {             "name": "inventorycontext",             "customannotation:useclrtypes": "true",             "entityset": [{                 "name": "products",                 "entitytype": "self.product"             }, {                 "name": "purchaseorders",                 "entitytype": "self.purchaseorder"             }, {                 "name": "sellorders",                 "entitytype": "self.sellorder"             }],             "associationset": [{                 "name": "purchaseorder_product",                 "association": "self.purchaseorder_product",                 "end": [{                     "role": "purchaseorder_product_source",                     "entityset": "purchaseorders"                 }, {                     "role": "purchaseorder_product_target",                     "entityset": "products"                 }]             }, {                 "name": "sellorder_product",                 "association": "self.sellorder_product",                 "end": [{                     "role": "sellorder_product_source",                     "entityset": "sellorders"                 }, {                     "role": "sellorder_product_target",                     "entityset": "products"                 }]              }]         }     } 

any idea?


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -