Skip to content Skip to sidebar Skip to footer

Create New Entity With New Entity Type In Breeze

I'm writing cordova + angular + breeze app where text info from element should be stored in the cash of browser that wraps the app. Accordind to the docs to do so, first I need to

Solution 1:

After created new EntityType, you should attach it to metadataStore to create entities of new type. Your code should look:

var metadataStore = new breeze.MetadataStore();
entityManager= new breeze.EntityManager({
            serviceName: "api/db",
            metadataStore: metadataStore
        });

// if you call fetchMetadata()
entityManager.fetchMetadata().then(function(){
    var newType = new breeze.EntityType({
        shortName: "input"
    });

    entityManager.metadataStore.addEntityType(newType);

    newType.createEntity(...);
    // ...
});

//or just use var metadataStore
var newType = new breeze.EntityType({
    shortName: "input"
});

entityManager.metadataStore.addEntityType(newType);

newType.createEntity(...);
// ...

Post a Comment for "Create New Entity With New Entity Type In Breeze"