0
votes

I am doing a simple projection query in Breeze:

        var p1 = new Predicate('ID', 'eq', articleID);
        var p2 = new Predicate('isDeleted', '!=', true);
        var p3 = new Predicate('isAutoSave', '!=', true);
        var query = EntityQuery.from(entityNames.article)
            .where(p1.and(p2.and(p3)))
            .select('Code, Description, ImageFileName, Notes, SupplierDistance')

I then used the entity mapper to create a partial entity to put into an observable to return back to the function. All was good.

Then I realised I needed a country name from a related table, so I first tried ".expand" and was told that Breeze couldn't do "expand" and "select" simultaneously. No problem, will select the related record directly:

            .select('Code, Description, Country.CountryName, ImageFileName, Notes, SupplierDistance')

But as there is no "Country_CountryName" property on the entity I am creating a partial of, the mapping fails (unsurprisingly) with an "undefined is not a function" error. How am I able to include the countryName field from the related table in this way where I cannot map the entity?

I tried stuffing the javascript object returned by the query into my observable but that fails with an "object is not a function" error so that's no good either.

1
This is similar to stackoverflow.com/questions/15793231/… where I don't want a full entity as it has craploads (about 80) float fields on the "article" record that I don't want! - TheMook

1 Answers

0
votes

I decided that the entity mapping was unnecessary in the end and reverted to a simple projection query where I manually handled the "expand".