Search code examples
breezebreeze-sharp

Transferring metadata from one EntityManager to another EntityManager


Currently I have a single WebAPI that returns the metadata for a number of client side apps. The client apps talk to different WebAPIs, not the one who provided the metadata. I don't like the idea of pre-generating the metadata, saving in a js file and reloading it at the client - the kind of approach RIA has.

How can I transfer the metadata from one EntityManager (connected to the webapi that provides the metadata) to "other" EntityManager which has the model entities so this "other" EntityManager can do the change tracking?


Solution

  • If you have an EntityManager, you can use its MetadataStore in the constructor for any other EntityManager like so:

     var entityManager2 = new EntityManager({ 
        serviceName: aServiceName, 
        metadataStore: entityManager1.metadataStore }
     );