Make a selection and deploy in the same query when the wind is not supported

I am developing an asp.net solution with Durandal / breeze.

Here is my code to get all my shippers:

var query = EntityQuery.from('Shippers')
               .select('id, name, street, city');

return manager.executeQuery(query)
        .then(querySucceeded)
        .fail(queryFailed);

Here is a related model:

public class Shipper
{
    [Key]
    public int Id { get; set; }
    public string Name { get; set; }
    public string Street { get; set; }
    public string Number { get; set; }
    public City City { get; set; }
}

public class City
{
    public int Id { get; set; }        
    public string Name { get; set; }
    public string PostCode { get; set; }
    public Country Country { get; set; }
}

Now I also need to specify the countries

public class Country
{
    [Key]
    public int Id { get; set; }
    public string Code { get; set; }
    public string Name { get; set; }
}

But with the actual request, I do not get the country with him.

I'm trying to:

var query = EntityQuery.from('Shippers')
               .select('id, name, street, city')
               .expand('City.Country');

but I get an error:

use of both 'expand' and 'select' in the same query is not currently supported

My question is : how to get countries?


UPDATE

As Jay suggested, we can do:

var query = EntityQuery.from('Shippers')
       .select('id, name, street, city, city.country')

Now I have an object city_Country:

enter image description here

I don’t understand why we got this city_Countryone because the country data is already available in the city \ country object:

enter image description here

, , dto , city_Country .

entity city_Country:

enter image description here

- , ?

:

function mapToEntity(entity, dto) {
     // entity is an object with observables
     // dto is from json
     for (var prop in dto) {
          if (dto.hasOwnProperty(prop)) {
             entity[prop](dto[prop]);
          }
     }
     return entity;
}
+5
2

, - , "" , , . "", .

var query = EntityQuery.from('Shippers')
    .where(...)
    .expand('city.country');

, , . , entityManager, .

: Breeze 'expand' , Entity Framework. , .

, ( )

var query = EntityQuery.from('Shippers')
   .where(...)
   .expand('city.country')

"" "" "" , ... , , ..

var query = EntityQuery.from('Shippers')
  .select('id, name, street, city, city.country')

5 . , entityManager "city" "city.country", "" .

- , "" " " . , . " " "", . , .

, .

+8

:

var query = EntityQuery.from('Shippers')
           .select('id, name, street, city, city.country')
+1

All Articles