You can eliminate the need for loading metadata in a separate network call from server by embedding it in your scripts and providing Breeze with it manually as @Ward suggested.
Here is how (I'm using TypeScript below):
import { DataService, EntityManager, MetadataStore, NamingConvention } from "breeze-client";
// Your metadata object
const metadata: any = Metadata.value;
// define the Breeze `DataService` for this app
const dataService: DataService = new DataService({
serviceName: "http://localhost:63000",
hasServerMetadata: false // don't ask the server for metadata
});
// create the metadataStore
const metadataStore: MetadataStore = new MetadataStore({
namingConvention: NamingConvention.camelCase // if you use this convention
});
// initialize it from the application's metadata variable
metadataStore.importMetadata(metadata);
const entityManagerConfig: EntityManagerOptions = {
dataService: dataService,
metadataStore: metadataStore
};
this.entityManager = new EntityManager(entityManagerConfig);
Now you have an EntityManager
instance initialized with the metadata and ready to execute queries.
For more informtion, see official docs