Search code examples
entity-frameworkbreezehottowel

breezejs navigation property with include not working


I have server side code written which is including navigational property for many to many relation ship as shown below.

var result = _contextProvider.Context.ResourceProperty.Include("AssociatedStandardResourceProperty.AssociatedLists").Where(t => t.ResourceId == resId);
        //Return matching resource properties
        return result;

However, when i am trying to retrieve data from breeze datacontext i am getting query execution error as shown below.

var getResourceProperties = function (resourceId, resourcePropertyObservable) {

        var query = EntityQuery.from('GetResourceProperties')
            .withParameters({ resourceId: resourceId })
            .expand("AssociatedStandardResourceProperty.AssociatedLists");

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

        function querySucceeded(data) {
            if (resourcePropertyObservable) {
                resourcePropertyObservable(data.results);
            }
            log('Retrieved listObservable from remote data source',
                data, true);
        }
    };

Query is failing and all data is retreived in log message i have written in queryFailed function.

I have also checked by removing expand at client side and also removing include at server side and then including expand at client side.

Please let me know how i can make it work.

Thanks


Solution

  • I have observed that problem was due to many to many mapping between two entities . After removing the relationship we are able to retrieve associatedEntities data