javascript - breezejs: adding referential constraint to an entity type -


this follow-up question my previous issue - 1 getting bit messy , more related telerik data service.

the metadata receive server missing referential constraints in association node, although i've set foreign key attribute on model.

therefore thinking manually adding these constraints entities in callback of fetchmetadata.

is possible , can provide simple example on how ?

[edit]

here's have far:

  manager.fetchmetadata().then(function () {         var mandattype = manager.metadatastore.getentitytype("mandate");         mandattype.autogeneratedkeytype = breeze.autogeneratedkeytype.identity;          var openpositionsprop = new breeze.navigationproperty({             name: "openpositions",             entitytypename: "openpositions:#directdebitmodel",              isscalar: true,             associationname: "openposition_mandate_mandate_openpositions",             foreignkeynames: ["id"]         });          mandattype.addproperty(openpositionsprop); }); 

but raises exception:

the 'mandate:#directdebitmodel' entitytype has been added metadatastore , therefore no additional properties may added it.

ok, have possible approach might able use right now.

  1. fetch metadata teleriks odata feed now.

  2. export metadatastore created result of previous step via metadatastore.exportmetadata method. return "stringified" json same metadata in breeze's native format. format easier work with.

  3. convert string json via json.parse.

  4. modify json add referential constraint information. see breeze native metadata format docs here

  5. create new metadatastore , import modified json it.

  6. create new entitymanager metadatastore , use it. entitymanager should have complete breeze metadata use rest of feed.

    hope makes sense!

    we planning on releasing form of hybrid metadata in next release. unfortunately, doesn't cover case because focusing on how add custom metadata existing metadatastore, , not edit/modify existing metadata.

    another alternative (ideablade) offer consulting type of work. write tool steps 1 thru 6 you. please contact breeze@ideablade.com if of interest , mention post.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -