Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracting Metadata with error involving 'isPrototypeOf' #41

Open
Catchops opened this issue Oct 12, 2016 · 0 comments
Open

Extracting Metadata with error involving 'isPrototypeOf' #41

Catchops opened this issue Oct 12, 2016 · 0 comments

Comments

@Catchops
Copy link

I am trying to implement the aurelia-breeze library into a new aurelia application, and when the first query is run, the library is trying to download the Metadata and it fails returning the error:

"Metadata query failed for: http://localhost:8080/api/CE/CE/Metadata; TypeError: Cannot read property 'isPrototypeOf' of undefined"

I have been successful in hitting that same service using basic Breeze, but I found this library and thought I would implement it to take advantage of some of the out of the box features. (e.g. removing Q from the list of libraries, etc)

I'm using the entity-manager-factory to encapsulate the entityManager as seen in the aureliea-breeze-northwind demo. It is used by a service object to extract the data from my web.api. Here is the service object:

import breeze from 'breeze';
import {createEntityManager} from '../entity-manager-factory';

export class PartyDataService {

    /**********************************************
     * loadExistingHospital
     * id - integer Id of the hospital you are needing
     **********************************************/
    loadExistingHospital(id) {

        var hospitalQuery = new breeze.EntityQuery().from('Hospitals')
            .where('HospitalId', '==', id)
            .select('Organization.Name', 'Organization.Url', 'Organization.IsActive', 'IsPending');

        return createEntityManager()
            .then(em => em.executeQuery(hospitalQuery))
            .then(queryResult => {
                return {
                    entity: queryResult.results[0],
                    entityManager: queryResult.entityManager
                };
            })
            .catch(error => {
                alert('error on Load by Id');
            });

    }

    /**********************************************
     * loadHospitalList - loads all hospitals from this list.
     **********************************************/
    loadHospitalList() {

        var hospitalQuery = new breeze.EntityQuery().from('Hospitals');
            //.select('Organization.Name', 'Organization.Url', 'Organization.IsActive', 'IsPending')
            //.orderBy('Organization.Name');

        return createEntityManager()
            .then(em => em.executeQuery(hospitalQuery))
            .then(queryResult => {
                return {
                    entity: queryResult.results,
                    entityManager: queryResult.entityManager
                };
            })
            .catch(error => {
                alert('error on Load List');
            });


    }


}

I have the plugin being instantiated from my main.js file:

import {LogManager} from 'aurelia-framework';
import {ConsoleAppender} from 'aurelia-logging-console';
import {ConventionalViewStrategy} from 'aurelia-framework';
import {Configure} from 'aurelia-configuration';

LogManager.addAppender(new ConsoleAppender());
LogManager.setLevel(LogManager.logLevel.debug);

export function configure(aurelia) {

    aurelia.use
        .standardConfiguration()
        .developmentLogging()
        .plugin('aurelia-configuration',
            config => {
                config.setCascadeMode(false);
                config.setEnvironments({
                    Code: ['localhost'],
                    Dev: ['zzzzzzzzzz'],
                    QA: ['yyyyyyyyy'],
                    Prod: ['xxxxxxxxxx']
                });
                config.setDirectory('CeApps/configs');
                config.setConfig('config.json');
            })
        .plugin('aurelia-kendoui-bridge', (kendo) => kendo.pro())
        .plugin('aurelia-breeze');   // install the aurelia-breeze integration plugin.
    ;

    aurelia.start().then(a => a.setRoot('CeApp/app'));

}

I must be missing something - any thoughts??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant