title: Breeze Loading metadata or entity type on demand
body: <p>To reduce the size of breeze meta data, we are planning to make entity based meta data. So that each entity meta data will be downloaded from the server on demand.</p>
  
  <p>Previously, the metadata was downloaded by breeze(normal behavior) and it works fine for us. To achieve the on demand loading of meta data, i tried the "importMetadata" functionality. But "entityManager.HasChanges()" always return "false", but the user input data is there in the json entity. </p>
  
  <p>I used the below code snippet to do the same.</p>
  
  <pre><code>   constructor(private bwhttp: BWHttp) {
      this.em = new EntityManager(this.serviceName);
      this.em.dataService.hasServerMetadata = false;
      this.em.saveOptions = new SaveOptions({ allowConcurrentSaves: true });        
  }
  
  public getData(data: string, formType?, args?, system?, taxtype?) {
  
      this.bwhttp.get("http://someserver.cdn.com/metadata/"+formType+".json").subscribe(httpdata =&gt; {
          var metadata = JSON.stringify(httpdata['_body']);
          this.em.metadataStore.importMetadata(metadata, true);
          this.getDataInternal(data, formType, args, system, taxtype);
      });
  
  }
  public saveChanges(propertyName: string) {
      this.applyPropertyChanges(propertyName);
      if (!this.em.hasChanges()) return;//it always gives false.
      this.em
          .saveChanges()
          .then(result =&gt; {
              this.status = "Changes Saved."
              this.hassaved.next(true);
          })
          .catch(err =&gt; {
              this.status = "Error:" + err.toString();
              this.em.rejectChanges();
          });
   }
  </code></pre>
  
  <p>Did i missed anything on this? Please help me on this. </p>